Tugger the SLUGger!SLUG Mailing List Archives

[slug-chat] Script challenge with tee


I have a problem,  I want to tee and still get the return code:

  prog  x y z | tee
  echo $?

Will always show zero because this is the return code of tee.  I need the 
return value of prog.

{
  prog x y z
  echo $?
} | tee

works but I want to capture the values so that I can exit much later with the 
value of this program.

{
   prog x y z
   RC=$?
}  | tee

  lp ...

exit $RC

RC is does not appear to be available to the script.

Any suggestions?

KenF

---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/