If N is omitted, stdout is assumed (FD 1). Faria May 18 '15 at 13:38 @terdon how do I redirect output to a file which has no "w" permission for others , I meant to ask can I Please keep this field empty: Show pagesource Old revisions Backlinks syntax/redirection.txt · Last modified: 2013/04/14 14:30 by thebonsai This site is supported by Performing Databases - your experts for database The MULTIOS option means that echo something >&1 | other_command will output to FD 1 and pipe the output to other_command, rather than only piping it. have a peek at this web-site
ls -l 2>&1 >&3 3>&- | grep bad 3>&- # Close fd 3 for 'grep' (but not 'ls'). # ^^^^ ^^^^ exec 3>&- # Now close it for the remainder of How to explain centuries of cultural/intellectual stagnation? Not the answer you're looking for? stdout goes to /dev/null, stderr still (or better: "again") goes to the terminal. http://www.tldp.org/LDP/abs/html/io-redirection.html
First is: the redirection happens from left to right. Redirect standard output; overwrite file if it exists >&! The TARGET is not truncated before writing starts. Here documents <
Standard error Standard error (“stderr”) is like standard output and standard input, but it’s the place where error messages go. LOGFILE=script.log echo "This statement is sent to the log file, \"$LOGFILE\"." 1>$LOGFILE echo "This statement is appended to \"$LOGFILE\"." 1>>$LOGFILE echo "This statement is also appended to \"$LOGFILE\"." 1>>$LOGFILE echo "This There are 3 default standard files (standard streams) open: [a] stdin - Use to get input (keyboard) i.e. Ambiguous Output Redirect When Bash creates a child process, as with exec, the child inherits fd 5 (see Chet Ramey's archived e-mail, SUBJECT: RE: File descriptor 5 is held open).
Best leave this particular fd alone.PrevHomeNextHere StringsUpUsing exec