E.Cross
E.Cross

Reputation: 2137

What does the "-;" mean at the end of a bash statement?

For example

bwa sampe ref.fa r1.sai r2.sai r1.fq r2.fq | samtools view -bSho out.bam -;

What is the purpose of the "-;" characters at the end? What do they do? Why are they necessary?

Upvotes: 3

Views: 2076

Answers (1)

thb
thb

Reputation: 14454

The semicolon ends the command (to end the pipeline is, I believe, technically the right way to say it). You could follow it with another command if you wanted to, as in

bwa sampe ref.fa r1.sai r2.sai r1.fq r2.fq | samtools view -bSho out.bam -; echo Here is another command.

Otherwise, the semicolon is harmless but probably unnecessary.

Regarding the - hyphen that precedes the semicolon, for samtools and many other commands it means to use standard input in place of an input file (or, in some cases, standard output in place of an output file). This is typical Linux/Unix usage.

(Thanks to @phatfingers for verifying the usage of the samtools command.)

Upvotes: 5

Related Questions