You could do:
[ "$PROCEED" = "y" ] ; BOOL=$?
If you’re working with set -e
, you can use instead:
[ "$PROCEED" = "y" ] && BOOL=0 || BOOL=1
BOOL
set to zero when there is a match, to act like typical Unix return codes. Looks a bit weird.
This will not throw errors, and you’re sure $BOOL
will be either 0 or 1 afterwards, whatever it contained before.