Wrapper to mount partition before launching executable Solved task is pretty straightforward: mounting partition if not mounted already, to start executable.
There is a couple of checks and notifications because it is supposed to be launched from X and there are no way to see stdout/stderr stream. I have started with much larger version and a lot of error handling, that is why it has a function despite being so simple. On the other hand, it is much more cleaner of what is going on, when you read it and it will be easier to come back to it later on.
#!/usr/bin/env bash
DEVICE=&quot;/dev/sda5&quot;
PARTITION=&quot;/mnt/Games&quot;
EXECUTABLE=&quot;$PARTITION/MultiMC/MultiMC&quot;

launch() {
    if ! findmnt &quot;$PARTITION&quot;; then
        DETAILS=`SUDO_ASKPASS=&quot;$(which ssh-askpass)&quot; sudo --askpass mount &quot;$DEVICE&quot; &quot;$PARTITION&quot; 2&gt;&amp;1`
        [ $? -ne 0 ] &amp;&amp; return 1
    fi
    notify-send &quot;Launching..&quot;
    exec &quot;$EXECUTABLE&quot;
}

launch || notify-send &quot;Launching failed&quot; &quot;$DETAILS&quot;
[ $? -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;
}