1

Here is a toy shell script:

#!/bin/bash
set -e

misspelled_command

exec > run_$( date +%Y%m%d ).log 2>&1

echo "Logging"

exit

If I submit with nohup bash raise_errors.sh > /dev/null 2> errors.log & the error will be logged in errors.log as expected:

$  cat errors.log 
nohup: ignoring input
raise_errors.sh: line 5: misspelled_command: command not found

Is there any way to redirect the error to appear to the user in the terminal instead of errors.log? Also, why does nohup: ignoring input appear and how can it be avoided?

  • If you're just trying to create a script that will run a long time surviving your logout, but that you can still see messages from have you considered using screen or tmux or something like that? – Eric Renouf Dec 20 '16 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.