From 49a1622ad8b9545c043a5a6ba7c46ea37b95b0f0 Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 24 Feb 2024 19:58:49 +0100 Subject: fix(hm/conf/lf/cmds): Better manage files with pre-defined extensions --- hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh') diff --git a/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh b/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh index 6ceed95e..bc57563c 100755 --- a/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh +++ b/hm/soispha/conf/lf/commands/scripts/mk_scr_default.sh @@ -14,9 +14,10 @@ id="$id" prompt "Script name: " name="" -while [ -z "$name" ] || [ -e "$name.sh" ]; do - read -r name - if [ -e "$name.sh" ]; then +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name_base + name="$name_base.sh" + if [ -e "$name" ]; then prompt "Script already exists, overwrite [y|N]: " read -r ans @@ -30,7 +31,7 @@ done script="$(pwd)"/"$name" -cat "%SHELL_LIBRARY_TEMPLATE" >"$script.sh" +cat "%SHELL_LIBRARY_TEMPLATE" >"$script" chmod +x "$script" "$VISUAL" "$script" -- cgit 1.4.1