LoginSignup
1
1

More than 5 years have passed since last update.

標準出力と標準エラー出力

Posted at

標準出力(std) 1
標準エラー出力(std_err) 2
aの出力先をbの出力先にマージする a>&b

標準出力のlogへのリダイレクト

bash script.sh > log
bash script.sh 1> log

標準エラー出力のlogへのリダイレクト

bash script.sh 2> log

標準出力→標準エラー出力の順でlogに一括してリダイレクト

bash script.sh > log 2>&1
  1. 標準出力をlogにリダイレクト
  2. 標準エラー出力のリダイレクト先を標準出力のリダイレクト先にマージ
  3. 結果としてstd_errはlogに出力される
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1