nohup.out and dismisses
stderr. I would like to have it the other way around:
stderr to a file and dismiss
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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.