If the user tries to open a file descriptor for writing more than once, the shell opens the file descriptor as a pipe to a process that copies its input to all the specified outputs, similar to tee, provided the MULTIOS option is set, as it is by default. Thus:
date >foo >bar
writes the date to two files, named ‘foo’ and ‘bar’. Note that a pipe is an implicit redirection; thusdate >foo | cat
writes the date to the file ‘foo’, and also pipes it to cat.
- bashで「ls > test | cat」をしても何も表示されない
- 一方でzshでは「ls > test | cat」でlsの標準出力が表示される