Does anyone know how to trap errors from within piped commands in KSH???
ls -l /non-existent-dir | ls -l /existing-dir
I want to find out if the first command failed or if the second one failed.
ls -l /non-existent-dir 2> err.file | ls -l /existing-dir 2>> err.file
if [ -s err.file ]
echo "ERROR: `cat err.file`"
I think this is rather ugly.