Last active
August 29, 2015 14:08
-
-
Save lavoiesl/c01b16b5f875906a6d82 to your computer and use it in GitHub Desktop.
Starting a text editor from inside a Virtual Machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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