Skip to content

Instantly share code, notes, and snippets.

@borgand
Created June 3, 2010 12:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borgand/423820 to your computer and use it in GitHub Desktop.
Save borgand/423820 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Shell script to mount SSHFS while MacFusion is defunctional
# original idea by: renatojf
# written by: laas.toom@gmail.com
# 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