mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 21:05:52 +10:00
in the source environment. Also catch tool errors in the gvm script and function.
17 lines
632 B
Bash
17 lines
632 B
Bash
#!/bin/bash
|
|
function gvm_use() {
|
|
[[ "$1" != "" ]] ||
|
|
display_error "Please specifiy the version" || return 1
|
|
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
|
display_error "Invalid version $1" || return 1
|
|
|
|
export PATH=$GVM_PATH_BACKUP
|
|
. $GVM_ROOT/environments/$fuzzy_match &> /dev/null || display_error "Couldn't source environment" || return 1
|
|
if [[ "$2" == "--default" ]]; then
|
|
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default || display_error "Couldn't make $fuzzy_match default"
|
|
fi
|
|
|
|
display_message "Now using version $fuzzy_match"
|
|
}
|
|
|