System Management

A cron job runs ./backup.sh, which prints progress messages to standard output and errors to standard error. An administrator wants progress messages saved in backup.log and error messages saved separately in backup.err. Which command does this?

Show the answer

Correct answerC. ./backup.sh > backup.log 2> backup.err

File descriptor 1 (stdout) goes to backup.log and descriptor 2 (stderr) goes to backup.err. Using 2>&1 is tempting but merges stderr into stdout, so both streams land in backup.log and backup.err stays empty.