I need to depend on few separate executions in a script and don\'t want to bundle them all in an ugly \'if\' statement. I would like to take the exit code \'$?\' of each executi
Use the $(( ... )) construct.
$(( ... ))
$ cat st.sh RESULT=0 true RESULT=$(($RESULT + $?)) false RESULT=$(($RESULT + $?)) false RESULT=$(($RESULT + $?)) echo $RESULT $ sh st.sh 2 $