[lang-ref] ( get_command_return_code ) ( bash )
@test "get command return code" {
# $?
r=$(ls /etc/hosts > /dev/null ; echo $?)
[ "$r" -eq 0 ]
r=$(ls /no/such/file 2> /dev/null ; echo $?)
[ "$r" -eq 1 ]
}
@test "get command return code" {
# $?
r=$(ls /etc/hosts > /dev/null ; echo $?)
[ "$r" -eq 0 ]
r=$(ls /no/such/file 2> /dev/null ; echo $?)
[ "$r" -eq 1 ]
}