function display_error() { tput sgr0 tput setaf 1 echo "ERROR: $1" >&2 tput sgr0 return 1 } function display_message() { # GREEN! tput sgr0 tput setaf 2 echo "$1" tput sgr0 } function gvm_use() { [[ "$1" != "" ]] || display_error "Please specifiy the version" || return 1 fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` || display_error "Invalid version $1" || return 1 export PATH=$GVM_PATH_BACKUP . $GVM_ROOT/environments/$fuzzy_match if [[ "$2" == "--default" ]]; then cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default fi display_message "Now using version $fuzzy_match" }