From d1f6dec046e6a45365e1b21e80ba20a7517475e3 Mon Sep 17 00:00:00 2001 From: ed neville Date: Sat, 21 Dec 2024 22:22:59 +0000 Subject: [PATCH] Pad menu items and align enable status * if the editor quits non-zero ask if action should abort --- scripts-needed/brc-script.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts-needed/brc-script.sh b/scripts-needed/brc-script.sh index ed2e10f..264caf7 100755 --- a/scripts-needed/brc-script.sh +++ b/scripts-needed/brc-script.sh @@ -72,6 +72,21 @@ createscript() { ### END NEW SCRIPT ### vim "$newscriptav" + if [ $? -ne 0 ]; then + echo "------------------------------------" + echo " Editor aborted!" + echo " Continue or remove $namenewscript?" + echo "------------------------------------" + echo " 1 | Continue " + echo " 2 | Abort " + echo " Def | Continue " + echo "------------------------------------" + read answer + if [ "${answer}x" = "2x" ]; then + rm "$newscriptav" + return + fi + fi echo "------------------------------------" echo " Script $namenewscript created!" echo " Do you want to enable it?" @@ -95,11 +110,11 @@ listitem() { for i in $(ls "$available_scripts"); do inotext=${i:0:-3} (( index ++ )) + enabled="" if [ -f "$enabled_scripts$i" ]; then - echo "$index) - $inotext" - else - echo "$index) $inotext" + enabled="-" fi + printf "%5d | %1s %s\n" "$index" "$enabled" "$inotext" done }