I have to make a conditional in ash, that depends on result of two commands. The problem is one of them returns the result to stdout, the other as exitcode.
Do I have to write
command2
RET=$?
if [ `command1` -eq 1 -a $RET -eq 2 ] ; then ...
or is there some construct that would let me simply access return code of command2
within logic of [ ]
?
if [ `command1` -eq 1 -a ${{{ command2 }}} -eq 2 ] ; then ...
( with ${{{ }}}}
being the magical expression extracting the returncode ? )