Last active
July 8, 2019 23:05
-
-
Save kaizoku/593386 to your computer and use it in GitHub Desktop.
mount(8) wrapper which creates the target directory if it doesn't exist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wrapper for mount which mkdirs the mount target if it doesn't exist | |
device="${@: -2}" | |
mntdir="${@: -1}" | |
if [ "$device" -o "${device:0:1}" == "-" ] | |
then | |
: | |
elif [ "${mntdir:0:1}" == "-" ] | |
then | |
: | |
elif [ -d "$mntdir" ] | |
then | |
: | |
else | |
mkdir "$mntdir" | |
fi | |
mount ${@} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment