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

Bash help requested: Capturing command errors within pipes




I have been trying to capture bash pipe errors as follows:

ret1=0; ret2=0; ret3=0; ret4=0; ret5=0

out=$(\
grep "PATTERN" "${SFILE}"; ret1=$? 2>&1 | \
sed $re1 $re2; ret2=$? 2>&1 | \
sort -n; ret3=$? 2>&1 | \
uniq >> "${TFILE}"; ret4=$? 2>&1\
); ret5=$?

But the return status variables are not changed
should any command errors arise.

How could one go about capturing command errors within pipes?

Thanks!
Dan


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