Created
May 31, 2015 22:05
-
-
Save metaodi/6d589bc81e5fd7ea1d2c to your computer and use it in GitHub Desktop.
Status of all local vagrant boxes
This file contains 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 | |
root_dir="$HOME" | |
if [ -n "$1" ] ; then | |
root_dir=$1 | |
fi | |
for vdir in `find $root_dir -name .vagrant -type d 2>/dev/null`; do | |
cd $vdir | |
cd .. | |
vtext=`vagrant status 2>/dev/null | awk '{$1=""; print $0}' | sed 's/^ //g' | grep 'virtualbox' | GREP_COLOR="2;32" egrep --color=always "(not created|poweroff)"` | |
if [ -z "$vtext" ] ; then | |
vtext=`vagrant status 2>/dev/null | awk '{$1=""; print $0}' | sed 's/^ //g' | grep 'virtualbox' | egrep --color=always "(running)"` | |
fi | |
if [ -z "$vtext" ] ; then | |
vtext=`echo missing | GREP_COLOR="2;36" egrep --color=always "(missing)"` | |
fi | |
echo "$vtext: "`pwd` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment