Johannes Linkels
Johannes Linkels

Reputation: 223

What does the "&" mean in this Tcl statment

The line is this:

if [catch {open "|$command |& cat"} input] {

This is code fragment from http://www.beedub.com/book/2nd/TKEXAMPL.doc.html

I came so far that |$command describes a command pipeline. The output is piped into cat to output errors into the pipe immediately, according to that tutorial page.

input is the name of the file descriptor. It is open for read later on.

But it is totally opaque what the "&" symbol does in "|& cat"

Upvotes: 0

Views: 170

Answers (1)

mrcalvin
mrcalvin

Reputation: 3434

But it is totally opaque what the "&" symbol does in "|& cat"

The documentation on exec says:

Separates distinct commands in the pipeline. Both standard output and standard error of the preceding command will be piped into the standard input of the next command. This form of redirection overrides forms such as 2> and >&.

So, as opposed to |, |& will also pipe the standard error of $command into the standard input of cat.

Upvotes: 2

Related Questions