Created
June 28, 2012 06:38
-
-
Save pjxiao/3009527 to your computer and use it in GitHub Desktop.
save in variable and display STDOUT / 標準出力を変数に保存しつつ表示する
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/bash | |
# 動きません☆ | |
stdout_log='' | |
<command> | | |
while read -r line | |
do | |
$stdout_log="$stdout_log$line" | |
echo "$line" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
パイプでつなげた while はサブシェルで実行されるため、while 文中の変数を参照することができない。
http://www26.atwiki.jp/ghostwind/pages/54.html