aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-12-03 06:29:10 -0300
committerEuAndreh <eu@euandre.org>2022-12-03 06:29:10 -0300
commit80ec06535e4ec27f63990c517a90da10b6228937 (patch)
treef34c606863ff11da427cb071abab79289d300642
parentetc/ssh/known_hosts: Add Ubuntu VM key (diff)
downloaddotfiles-80ec06535e4ec27f63990c517a90da10b6228937.tar.gz
dotfiles-80ec06535e4ec27f63990c517a90da10b6228937.tar.xz
bin/vm: Bail out when given a bad prefix
-rwxr-xr-xbin/vm5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/vm b/bin/vm
index d82b396..12fd6c8 100755
--- a/bin/vm
+++ b/bin/vm
@@ -144,6 +144,11 @@ guess_name() {
sed 's/^/- /' >&2
exit 2
fi
+ if [ -z "$IMAGES" ]; then
+ printf 'Cannot guess name with the given prefix: "%s".\n' "$PREFIX" >&2
+ printf '\nNo possibilities were found.\n' >&2
+ exit 2
+ fi
printf '%s\n' "$(basename "$IMAGES" .qcow2)"
}