Skip to content

Instantly share code, notes, and snippets.

@jdbrice
Created July 7, 2015 23:09
Show Gist options
  • Select an option

  • Save jdbrice/6a9db7fb5a99d67826ad to your computer and use it in GitHub Desktop.

Select an option

Save jdbrice/6a9db7fb5a99d67826ad to your computer and use it in GitHub Desktop.
A script for mounting sshfs locations on OS X
#!/bin/bash
# Script for mounting remote directories using sshfs
# $1 - remote host
# $2 - remote dir
# $3 - local mount point
if mount | grep "on $3" > /dev/null; then
echo "Local directory $3 already mounted"
else
echo "not mounted - trying to mount"
echo "sshfs $1:$2 $3"
sshfs $1:$2 $3 -oauto_cache,noappledouble
fi
if [ "$4" = "-reset" ]
then
echo "Trying to reset mount"
echo "diskutil unmount $3"
diskutil unmount $3
echo "Attempting to remount"
echo "sshfs $1:$2 $3"
sshfs $1:$2 $3 -oauto_cache,noappledouble
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment