nohup.out and dismisses
stderr. I would like to have it the other way around:
stderr to a file and dismiss
You can do it like this:
nohup command 2>&1 >/dev/null &
Because the first redirect is from STDERR to current handler of
STDOUT it write to
STDOUT is redirected to
Just redirect standard error to the file you want:
$ ls test.sh $ cat test.sh #!/bin/bash echo "out" echo "error" 1>&2 $ ./test.sh out error $ nohup ./test.sh < /dev/null > /dev/null 2> err.out $ ls err.out test.sh $ cat err.out error
From the manual:
If standard input is a terminal, redirect it from an unreadable file. If standard output is a terminal, append output to
$HOME/nohup.outotherwise. If standard error is a terminal, redirect it to standard output. To save output to FILE, use
nohup COMMAND > FILE.
Given that it is silent if stderr is redirected, it stands to reason that it would behave normally, and, as shown above, it does.