Reputation: 3652
I'm trying to figure out what this means/how $?
gets populated in linux, I tried doing a search but if someone could clarify that would be great:
exitstat=$?
if [ $exitstat -ne 0 ]
then
echo -e "Could Not Extract"
echo -e "Aborting Script `date`"
exit $exitstat
fi
The code above that is:
_xfile << %% 2> /files/thefile-7000.log | _afile -x -r 10 2> /files/thefile-7000.log > /files/thefile.7000
OperatorHigh = $finalnumber
%%
Upvotes: 1
Views: 541
Reputation: 295619
$?
expands to the exit status of the most recent foreground command.
Since your prior command is a pipeline, the exit status is that of the last command in the pipeline -- in this case, _afile
-- unless the pipefail
shell option is set, in which case failures elsewhere in the pipeline can also make exit status nonzero.
Upvotes: 4