Quantcast
Viewing all articles
Browse latest Browse all 8

Answer by Stéphane Chazelas for Is it a UUOC (useless use of cat) to redirect one file to another?

In zsh, the shell where < file1 > file2 works, the shell does invoke cat.

For a command line that consists only of redirections and no command nor assignments, zsh invokes $NULLCMD (cat by default) unless the only redirection is a < one in which case $READNULLCMD (pager by default) is invoked instead. (that's unless zsh is in sh or csh emulation in which case it behaves like the shells it emulates).

So:

< file1 > file2

is actually the same as

cat < file1 > file2

and

< file1

is the same as

pager < file1

Viewing all articles
Browse latest Browse all 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>