Purpose:Copy standard input to standard output, and then copy the specified file(s) to standard output

 

Format:Y file ...

 

fileThe file or list of files to send to standard output.

 

See also: TEE, piping and redirection.

 

Usage:

 

The Y command copies input from standard input (usually the keyboard) to standard output (usually the screen). Once the input ends, the named files are appended to standard output.

 

For example, to get text from standard input, append the files MEMO1 and MEMO2 to it, and send the output to MEMOS:

 

y memo1 memo2 > memos

 

The Y command is most useful if you want to add redirected data to the beginning of a file instead of appending it to the end. For example, this command copies the output of DIR, followed by the contents of  the file DIREND, to the file DIRALL:

 

dir | y dirend > dirall

 

If you are typing at the keyboard to produce input text for Y, you must enter a Ctrl-Z to terminate the input.

 

When using Y with a pipe you must take into account that the programs on the two ends of the pipe run simultaneously, not sequentially.

 

See Piping for more information on pipes.