LoginSignup
9
7

More than 5 years have passed since last update.

shell script で tee つかったときの終了コード取得方法

Last updated at Posted at 2013-05-01
shell
make all | tee log.txt;
if [[ "${PIPESTATUS[0]}" == 1 ]] || [[ "$pipestatus[1]" == 1 ]]; then
  echo ng;
else
  echo ok;
fi;

$pipestatus[1] は zsh の場合
${PIPESTATUS[0]} は bash の場合

http://www.unix.com/shell-programming-scripting/92163-command-does-not-return-exit-status-due-tee.html を参考に

9
7
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
9
7