[CentOS] Basic Bash Script Question

Mon Feb 21 10:47:24 UTC 2011
Philippe Naudin <philippe.naudin at supagro.inra.fr>

Le lun 21 fév 2011 10:31:38 CET, James Bensley a écrit:

> I'm stuck trying to work this one out and my Google skills are
> apparently lacking today.
> 
> This is a test bash script;
> 
> #!/bin/bash
> 
> do something | tee a.log
> 
> if [ $? -ne 0]; then
>  echo broken
> fi

What about :

{ do something ; RETCODE=$? ; } | tee somefile
echo $RETCODE

-- 
Philippe