Wrapper to mount partition before launching executable
[ $? -ne 0 ] is a well-known over-complication - you can replace that with a simple || in the pipeline:
DETAILS=`SUDO_ASKPASS=&quot;$(which ssh-askpass)&quot; sudo --askpass mount &quot;$DEVICE&quot; &quot;$PARTITION&quot; 2&gt;&amp;1` \
    || return $?

And in fact we can have a whole chain here:
launch() {
    findmnt &quot;$PARTITION&quot; \
        || DETAILS=`SUDO_ASKPASS=&quot;$(which ssh-askpass)&quot; sudo --askpass mount &quot;$DEVICE&quot; &quot;$PARTITION&quot; 2&gt;&amp;1` \
        || return $?
    notify-send &quot;Launching..&quot;
    exec &quot;$EXECUTABLE&quot;
}


If you have chronic installed, that could replace the tedious saving of output into DETAILS:
NAME
       chronic - runs a command quietly unless it fails

SYNOPSIS
       chronic [-ev] COMMAND...

DESCRIPTION
       chronic runs a command, and arranges for its standard out and standard
       error to only be displayed if the command fails (exits nonzero or
       crashes).  If the command succeeds, any extraneous output will be
       hidden.

So,
launch() {
    findmnt &quot;$PARTITION&quot; \
        || SUDO_ASKPASS=&quot;$(which ssh-askpass)&quot; \
           chronic sudo --askpass mount &quot;$DEVICE&quot; &quot;$PARTITION&quot; \
        || return $?
    notify-send &quot;Launching..&quot;
    exec &quot;$EXECUTABLE&quot;
}