Last active
December 22, 2016 09:24
-
-
Save okisanjp/58a68d0101d723b9a787 to your computer and use it in GitHub Desktop.
bash:標準出力も標準エラーもログに出力 ref: http://qiita.com/okisanjp/items/4bdf009176ecae312f84
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "foo" | |
cat ./sonna_file_naiyo.txt | |
echo "bar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sh ./test.sh | tee test.log | |
foo | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ./test.log | |
foo | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sh ./test.sh 2>&1 | tee test.log | |
foo | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ./test.log | |
foo | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sh ./test.sh > test.log 2>&1 | |
$ cat test.log | |
foo | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sh ./test.sh | tee test.log 2>&1 | |
foo | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
bar | |
$ cat test.log | |
foo | |
bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sh ./test.sh 2>&1 > test.log | |
cat: ./sonna_file_naiyo.txt: No such file or directory | |
$ cat test.log | |
foo | |
bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment