retrieve error code from a command launched within a bash script -


ok i'm kind of new bash scripting [the advanced stuff] , need little help. don't know how phrase i'll explain doing , need know it. in script run ./configure , need able catch if there error in configure , react accordingly within bash script.

the code is:

function dobuild { echo -e "\e[1;35;40mexecuting bootstrap , configure\e[0m" cd /devel/xbmc if [ $debug = "1" ]; #either outputs screen or nulls output ./bootstrap >/dev/null /usr/bin/auto-apt run ./configure --prefix=/usr --enable-gl --enable-vdpau --enable-crystalhd --enable-rtmp --enable-libbluray  >/dev/null else ./bootstrap /usr/bin/auto-apt run ./configure --prefix=/usr --enable-gl --enable-vdpau --enable-crystalhd --enable-rtmp --enable-libbluray fi } 

and configure returns error 1 or 2 how trap , act on it?

tia

after execution of command, returned value stored in shell variable $?. have match return values of success , failure

if [ $? == 1 ]     #do else     #do else fi 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -