Skip to content

Instantly share code, notes, and snippets.

@lekhnath
Forked from chasingmaxwell/vagrant-anywhere
Created April 9, 2016 19:05
Show Gist options
  • Save lekhnath/8374dc4ea9b57a3f7d36136d86f7ef8e to your computer and use it in GitHub Desktop.
Save lekhnath/8374dc4ea9b57a3f7d36136d86f7ef8e to your computer and use it in GitHub Desktop.
Run the vagrant command for a particular project from anywhere
#!/bin/sh
# Run the vagrant command for a particular project from anywhere.
#
# To use:
# 1. Put this file in ~/bin/ or some other executable path (also make sure the
# file is executable).
# 2. Insert the path to the directory containing your project's Vagrantfile
# where indicated below.
# 3. Rename this file to match the project you're using it for.
#
# Now you can use this script as a replacement for the "vagrant" command. For
# example, if you renamed this file "projectname" you could start up your
# vagrant vm for that project from anywhere with `projectname up`. Then
# suspend it again with `projectname suspend`.
vagrant_directory="/path/to/the/directory/containing/your/vagrantfile"
cd $vagrant_directory
vagrant "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment