Created
June 3, 2010 12:28
-
-
Save borgand/423820 to your computer and use it in GitHub Desktop.
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 | |
# Shell script to mount SSHFS while MacFusion is defunctional | |
# original idea by: renatojf | |
# written by: [email protected] | |
# Split the $1 for useful information | |
usr=${1/@*/} | |
usr=${usr:=$USER} | |
[[ $1 =~ ":" ]] && dst=${1/*:/} | |
srv=${1/*@/} | |
srv=${srv/:$dst/} | |
# If server name is missing, exit | |
srv=${srv:?"Server name missing!"} | |
# If dst folder is given, add it to mountpoint | |
mnt=$srv${dst:+"_$dst"} | |
# substitute _ for every / in the mount point name | |
mnt=${mnt////_} | |
# if dst is not given, make it . | |
dst=${dst:=.} | |
mkdir /Volumes/$mnt | |
/Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshfs-static $usr@$srv:$dst /Volumes/$mnt -o volname="$mnt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment