中間ファイルなしでSTDERRリダイレクト

中間ファイルなしでSTDERRリダイレクト

以下はおもちゃのシェルスクリプトです:

#!/bin/bash
set -e

misspelled_command

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

echo "Logging"

exit

送信中にエラーが発生すると、nohup bash raise_errors.sh > /dev/null 2> errors.log &期待どおりに error.log に書き込まれます。

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

エラーをユーザーに表示する代わりに端末にリダイレクトする方法はありますかerrors.log?また、これがnohup: ignoring input起こる理由とそれを防ぐ方法は何ですか?

ベストアンサー1

おすすめ記事