CPSC 1280 Lecture Notes - Lecture 17: Rmdir, Unix Shell, Mkdir
Document Summary
Appending output: when using , if output file doesn"t exist, shell creates it before execution, if output file exists, shell overwrites it, symbol >> is used to append the output stream to the end of an existing file. File descriptors for standard input and standard output are implicitly prefixed to the redirection symbols: $ wc /etc/passwd > newfile is equal to. $ wc /etc/passwd 1> newfile note: no space between 1 and : $ wc < /etc/passwd is equal to. $ wc 0< /etc/passwd: however, file descriptors for standard error streams must be explicit. Ex for redirection: $ cat foo cat: foo: no such file or directory, $ cat foo > errorfile. Yes cat: foo: no such file or directory: $ cat foo 2> errorfile. $ cat errorfile cat: foo: no such file or directory. Appending standard error: $ cat foo 2>> errorfile. Redirect standard output and standard error separately: $ foo. sh > bar1 2> bar2.