11月23日の学び
たまにしか使わないのでいつも迷います。。。
リダイレクト
$ ls 存在しないファイル 2> test.txt $ cat test.txt ls: foo: No such file or directory
標準エラー出力のリダイレクト
- &はファイル記述子の複製を行う
- &1は標準出力の複製を作成
# 以下のコマンドを実行すると標準エラー出力の出力先はtest.txtとなる ls 存在しないファイル > test.txt 2>&1
一括リダイレクト
#command &> file #若しくは #command >& file #で以下と同じ効果となる command > file 2>&1