Save $? before case statement.

In some shells (FreeBSD 9, ash) the case statement resets $?, so save
for later testing.
This commit is contained in:
Darren Tucker 2018-03-22 17:00:28 +11:00
parent 4c4e7f783b
commit c6cb2565c9
1 changed files with 3 additions and 2 deletions

View File

@ -101,9 +101,10 @@ check_valid_before() {
sed "s/.*/$opts &/" $origkeys >$authkeys
verbose "key option expiry-time $which"
${SSH} -q -F $OBJ/ssh_proxy somehost true
r=$?
case "$expect" in
fail) test $? -eq 0 && fail "key option succeeded $which" ;;
pass) test $? -ne 0 && fail "key option failed $which" ;;
fail) test $r -eq 0 && fail "key option succeeded $which" ;;
pass) test $r -ne 0 && fail "key option failed $which" ;;
*) fatal "unknown expectation $expect" ;;
esac
}