Re: Bash malfunction, or something else ??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday, Jan 23rd 2005 at 23:35 -0500, quoth Jim Cox:

=>The lines "missing" from the file might have been sent to stderr (or
=>stdlog) instead of stdout, and with your redirection will not go into
=>the file. You can use something like:
=>
=>  
=>
=>to send both stderr and stdout to the log file.
=>
=>The "Advanced Bash-Scripting Guide" is a great read for learing shell
=>programming:
=>  http://www.tldp.org/LDP/abs/html/
=>
=>and in particular the following chapter for I/O redirection:
=>  http://www.tldp.org/LDP/abs/html/io-redirection.html

Good Lord No! The order of evaluation is important

cmd 2>&1 > filename.log
is not the same as
cmd > filename.log 2>&1

The second will redirect output to filename and then also redirect stderr 
to the same place as stdout. This will *NOT* happen for the first example.

In the first example, stderr is redirected to where stdout is sent, but 
stdout hasn't been changed! Then stdout will go to filename.

I repeat: Order is important!.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux