Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Redirection order with multios option set



When multios option is set, the below two command are equivalent:

$ echo a >/tmp/test >/tmp/test1
$ echo a >/tmp/test1 >/tmp/test


Both command write `a` to `/tmp/test` and `/tmp/test1`.

Now to simulate `tee` command:

$ echo a >&1 >/tmp/test


or:

$ echo a >/dev/stdout >/tmp/test


work as expected, `a` was written to standard output as well as
`/tmp/test`. But swapping the redirection order produce different behavior:

$ echo a >/tmp/test >&1


write two lines `a` to file `/tmp/test`.

>From user perspective, this behavior seems to be in-consistent to me.

I read the documentation but find no information about this case. Is this
behavior intended?

Cuong Manh Le
https://cuonglm.xyz


Messages sorted by: Reverse Date, Date, Thread, Author