Re: Basic Bash Script Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux