Files
gvm/scripts/alias-create
T
Ali Abbas c1ec392bdd - Double quoting to avoid globbing
- Remove unecessary $(cat)
- switch * to ./* to avoid entries with dashes to be treated as options
- replace $* with "$@"
- repeating change path serial calls - unecessary if change path is called one (get script)
2014-04-12 15:56:54 +02:00

24 lines
722 B
Bash
Executable File

#!/usr/bin/env bash
. "$GVM_ROOT/scripts/functions"
[[ $1 != "" ]] ||
display_fatal "Please specifiy the alias name"
[[ $2 != "" ]] ||
display_fatal "Please specifiy the go version name"
[[ ! -f "$GVM_ROOT/environments/$1" ]] ||
display_fatal "Alias already exists!"
[[ -f "$GVM_ROOT/environments/$2" ]] ||
display_fatal "Target doesn't exist!"
mkdir -p "$GVM_ROOT/environments" ||
display_fatal "Could not create folder"
mkdir -p "$GVM_ROOT/gos/$1" ||
display_fatal "Could not create folder"
cp "$GVM_ROOT/environments/$2" "$GVM_ROOT/environments/$1" ||
display_fatal "Could copy environment"
echo "export gvm_alias_name=\"$1\"" >> "$GVM_ROOT/environments/$1" ||
display_fatal "Could not extend environment"