Skip to content

Instantly share code, notes, and snippets.

@borgand
Created Jun 3, 2010
Embed
What would you like to do?
#!/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