Created
January 22, 2020 16:39
-
-
Save dontfreakout/8072de95c8eedc802d64b6f06abfd25d to your computer and use it in GitHub Desktop.
Shell shortcuts for Homestead or any Vagrant box
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
function homestead() { | |
( cd ~/Homestead && vagrant $* ) | |
} | |
export -f homestead | |
## SSH to box and cd to same directory as current dir on local machine. If machine is offline, start it up before ssh to it | |
function homessh() { | |
if homestead status --machine-readable | grep state,running > /dev/null 2>&1; then | |
homestead ssh -- -t "cd code/${PWD##*/}; /bin/bash" | |
else | |
echo "Machine down. Starting it up before loging in..." | |
homestead up && homestead ssh -- -t "cd code/${PWD##*/}; /bin/bash" | |
fi | |
} | |
export -f homessh | |
alias homeup='homestead up' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment