[CentOS] Basic Bash Script Question
Philippe Naudin
philippe.naudin at supagro.inra.fr
Mon Feb 21 10:47:24 UTC 2011
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
More information about the CentOS
mailing list