runs as a subshell, how about this?
PARTITION_RECORD=$( set +e ; mount | grep "$PARTITION_DEV" ; true )
There are actually two points of failure involved here. First you need to +e
the subshell, so that the it doesn't trip right away when grep
Then when the subshell exits, it inherits the exit value of the final command run, so we just have to stick a true
command at the end to keep it from tripping in the main shell too.
BTW, if the format of the returned text isn't important, I'd suggest grep
directly, rather than mount
, and save yourself another level of subshell due to the pipe.