Skip to content

Instantly share code, notes, and snippets.

@cm3
Last active August 29, 2015 13:56
Show Gist options
  • Save cm3/9189757 to your computer and use it in GitHub Desktop.
Save cm3/9189757 to your computer and use it in GitHub Desktop.
By fixing the path of mount point to ~/.mnt/$1/, sshfsu provide more convenient sshfs wrapper.
function sshfsu(){
usage_exit() {
echo "Usage: sshfsu [options] host-setting-name"
echo ""
echo "By fixing the path of mount point to ~/.mnt/$1/, sshfsu provide more convenient sshfs wrapper."
echo "\"host-setting-name\" means what you declared after Host in ~/.ssh/config"
echo ""
echo "Options:"
echo " -h print help"
echo " -u unmount"
return 0
}
if [ $# -eq 0 ]; then
usage_exit
return 1
fi
local OPTIND
while getopts "hu:" opt; do
case ${opt} in
h)
usage_exit
return 0
;;
u)
fusermount -u ~/.mnt/${OPTARG}
return 0
;;
\?)
usage_exit
return 1
;;
esac
done
shift $((OPTIND-1))
sshfs $1: ~/.mnt/$1/
pcmanfm ~/.mnt/$1/
return 0
}
#!/bin/bash
usage_exit() {
echo "Usage: sshfsu [options] host-setting-name"
echo ""
echo "By fixing the path of mount point to ~/.mnt/$1/, sshfsu provide more convenient sshfs wrapper."
echo "\"host-setting-name\" means what you declared after Host in ~/.ssh/config"
echo ""
echo "Options:"
echo " -h print help"
echo " -u unmount"
exit 0
}
if [ $# -eq 0 ]; then
usage_exit
exit 1
fi
while getopts "hu:" opt; do
case ${opt} in
h)
usage_exit
exit 0
;;
u)
fusermount -u ~/.mnt/${OPTARG}
exit 0
;;
\?)
usage_exit
exit 1
;;
esac
done
sshfs $1: ~/.mnt/$1/
pcmanfm ~/.mnt/$1/
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment