4
votes
1answer
70 views

Can redirecting stdout and stderr to the same file mangle lines?

I've read that when redirecting stdout and stderr to the same file using 2>&1, stdout is usually block buffered while stderr is unbuffered. If a very long line is written to stdout, requiring ...
2
votes
1answer
1k views

nohup: ignoring input and redirecting stderr to stdout

I am starting my application in the background using nohup as mentioned below - root@phx5qa01c:/bezook# nohup java -jar ./exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar -c file ...
1
vote
1answer
80 views

Pipe not picking up stdout

I am running a java program from a OS X 10.8 bash terminal, and are trying to rederect the output it is producing. However, when either running this throug a pipe, or rederecting it to a file, the ...
7
votes
3answers
216 views

How to run a command while logging output to a file?

I have a console application that needs to be run as part of the deployment of a new application version on my server. This console application is designed to output to the console, and cannot be ...
5
votes
1answer
62 views

Is it possible to create sticky redirection from stdout/stderr

Consider such code: echo hello >> log.txt echo world >> log.txt I execute command with stdout redirection. Is it possible to create sticky redirection? Something like this: redir ...
12
votes
3answers
293 views

When to use redirection to stderr in shell scripts

I know that well-behaved utilities like grep output "normal" messages to stdout, and error messages to stderr. $ grep '^foo' file1 file2 file1:foo grep: file2: No such file or directory When I'm ...
2
votes
2answers
64 views

redirecting std output and std error

I have been trying to figure out the relationship between file descriptors. One thing I don't understand is, how is: ls -l /bin/usr > ls-output.txt 2>&1 different from: ls -l /bin/usr ...
2
votes
1answer
101 views

Why is it possible to refer to a closed stderr under bash?

I'd like to know why bash doesn't display an error message when we refer to a closed stderr. When it comes to other file descriptors, they have to be opened if we want to, for example, duplicate them. ...
2
votes
1answer
108 views

Stderr of piped shell scripts isn't always displayed

I piped my own shell scripts for some testing and accidentally noticed something strange. Namely, the stderr of those piped processes isn't always displayed on the screen. I simplified the scripts ...
7
votes
2answers
1k views

Does `Segmentation fault` message come under STDERR?

I ran an executable in bash ./code > log It shows occasional error messages on terminal whereas all printf statements go into log file. I re-run it like below ./code >& log Now, the ...
4
votes
2answers
215 views

Redirect stderr of the double-parentheses construct

I'd like to be able to redirect the stderr of a double-parentheses construct. For example: a=$(($var/$var2)) would output some error messages if $var2 = 0, I do not want the user to see this. I ...