Skip to content

Instantly share code, notes, and snippets.

@oakaigh
Last active January 21, 2020 00:28
Show Gist options
  • Save oakaigh/69f067cbb63783dae32057d3e3f79546 to your computer and use it in GitHub Desktop.
Save oakaigh/69f067cbb63783dae32057d3e3f79546 to your computer and use it in GitHub Desktop.
function scpinto() {
local server args rdir="/" ldir="/tmp/"
local options="reconnect,local,allow_other,defer_permissions"
while (( $# > 0 )); do
case "$1" in
-o) options+="-o $1"; shift ;;
-*) args+="$1 " ;;
*) [ "${server}" ] && args+="$1 " || server="$1" ;;
esac; shift
done
ldir+="/$(uuidgen)"
sshfs ${args} -o ${options} -o volname="${server}" ${server}:"${rdir}" "${ldir}" && \
ssh ${args} -t ${server} 'cd '"${rdir}"'; exec "${SHELL}"' && \
open "${ldir}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment