Wednesday, 15 June 2011

bash - Does '-' if standing for stdin have a specific name? -


In many command-line applications, if you do stereo pipe in them, then you have a - Character instead of an input file.

Sample:

  $ foo | Bar -  

Now I wonder: whether it is the official special name of the character - when used in this context, e.g. Dashed stadium operator or something like this? If so, then who?

The background of my question is that I want to write a task that detects this character and then behaves stdin accordingly instead of parsing the argument as an array , And I wonder how to call this function.

POSIX standard does not use any special name - This use of character says:

For utility, which use operands to represent files for reading or writing, then the '-' operation Should be used only for standard input (or standard output), it is clear from reference that an output file is being specified) or Program files -.

and then

where utility shells and utilities are described as POSIX.1-2008 are acceptable for compliance with these guidelines, or acceptable No, the standard input or output meant to the protected '-' means this usage is explained in the operands section. Otherwise, if such utility uses operands to represent files, then its implementation is defined as whether the operand is for 'standard' input (or standard output), or file name - .

Manual pages do not use any special names:

If no file is specified, or the file is "-" given, grep search standard input

It seems you have to invent your name.


No comments:

Post a Comment