Appending both stdout and stderr to file
3
votes
2
answers
1290
views
I have this:
nohup_ntrs(){
nohup_file="$HOME/teros/nohup/stdio.log"
mkdir -p "$(dirname "$nohup_file")";
echo " ------------- BEGIN $(date) -------------- " >> "$nohup_file"
nohup "$@" &>> "$nohup_file"
echo " ------------- END $(date) -------------- " >> "$nohup_file"
}
but this syntax is wrong:
nohup "$@" &>> "$nohup_file"
I was trying to use the >> operator for append but also send stderr there.
My guess is that the only way to do this is this:
nohup "$@" 2>&1 >> "$nohup_file"
is there a less verbose way to do this?
Asked by Alexander Mills
(10734 rep)
Aug 7, 2019, 05:50 PM
Last activity: Aug 7, 2019, 07:46 PM
Last activity: Aug 7, 2019, 07:46 PM