I want to run multiple commands that are concatenated via && with nohup.
The output of the commands are redirected to nohup.out which is fine. But I want send some messages in between to stdout. Is that possible?
A simple example would be like:
nohup sh -c " \
echo some message 1 (to stdout) && \
some command 1 (to nohup.out) && \
echo some message 2 (to stdout) && \
some command 2 (to nohup.out) && \
..." &
I tried to to redirect the messages to stderr within the commands and then redirect stderr back to stdout:
nohup sh -c " \
echo some message 1 >&2 && \
some command 1 (to nohup.out) && \
echo some message 2 >$2 && \
some command 2 (to nohup.out) && \
..." 2>&1 &
But this did not work for me.
Any suggestions?
stderr? where do you think it goes for each of yournohup,sh,echoandsomecommands?/dev/tty?