Is " - " a shortcut for stdout in bash? If not what does it mean? For example,
wget -q -O - $line
How about stdin?
Thanks and regards!
Stdout in the command pipeline In bash, sequential commands can connect by pipes, represented on the command line by a vertical bar ("|"). Pipeline commands are processed left-to-right, with the standard output (stdout) of each command connecting to the standard input (stdin) of the next.
1 "Standard output" output file descriptor. The expression 2>&1 copies file descriptor 1 to location 2 , so any output written to 2 ("standard error") in the execution environment goes to the same file originally described by 1 ("standard output").
Standard output (stdout) Standard output is a stream to which a program writes its output data. The program requests data transfer with the write operation. Not all programs generate output.
and >&2 means send the output to STDERR, So it will print the message as an error on the console. You can understand more about shell redirecting from those references: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Redirections.
As far as I know, bash
isn't involved with the usage of dash. It's just a convention of many UNIX command line utilities to accept -
as a placeholder for stdin
or stdout
when put in place of an input or output file name on the command line.
For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used only to mean standard input (or standard output when it is clear from context that an output file is being specified).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With