bashsh

What is the meaning of dash when piping shell commands?


mongodump -db somedb --collection somecollection --out - | gzip > dump.gz

What is the meaning of the dash in above command? It seems something to do with tunnel. But after looking up bash reference, I still can't get what's the meaning.


Solution

  • It means output goes to the stdout, so the pipe would pass it to the gzip. And it's not about bash(1), it's up to the program mongodump. In unix and linux, the dash - related to input or output, usually stands for stdin or stdout.