mwoehlke <[EMAIL PROTECTED]> wrote: > I am trying to figure out how to run a command and pipe the output > through tee, and then check the status of the original command.
This uses a bash-specific feature: cmd > >(tee file); status=$? This should work on any sh: exec 3>&1 && status=`exec 4>&1 && { cmd; echo $? >&4; } | tee file >&3` Or, if you don't want to clobber any descriptors, in case they might be in use for something else: : > file && { tail -f file & } && pid=$! && { cmd > file; status=$?; } && sleep 1 && # give tail a chance to print the last bits that were just written kill "$pid" paul _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash