Skip to content

Instantly share code, notes, and snippets.

@lavoiesl
Last active August 29, 2015 14:08
Show Gist options
  • Save lavoiesl/c01b16b5f875906a6d82 to your computer and use it in GitHub Desktop.
Save lavoiesl/c01b16b5f875906a6d82 to your computer and use it in GitHub Desktop.
Starting a text editor from inside a Virtual Machine
#!/bin/bash
# Starting Sublime Text from inside a Virtual Machine
# @link https://gist.github.com/lavoiesl/c01b16b5f875906a6d82
# You may require to install realpath
path="$(realpath "$1")"
if echo "${path}" | grep -q "^/media/data/projects"; then
path="$(echo "${path}" | sed 's/^\/media\/data\/projects\//~\/projects\//')"
elif echo "${path}" | grep -q "^/media/home"; then
path="$(echo "${path}" | sed 's/^\/media\/home\//~\//')"
else
echo "Only paths inside /media/data/projects and /media/home are supported" >&2
exit 1
fi
ssh [email protected] subl "${path}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment