From 27706b8b570133bb878946d79aa1b104bf0825f8 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 18 Mar 2024 14:07:17 +0100
Subject: [PATCH] fix: get filename from select with single value

---
 localdump.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/localdump.sh b/localdump.sh
index ac35250..e80867c 100755
--- a/localdump.sh
+++ b/localdump.sh
@@ -569,13 +569,14 @@ EOH
             # if there is a single dump in backup folder: 
             # '-rw-r--r-- 1 root root 481 Mar 13 12:27 ahcrawler__20240313-1227.sql.gz'
             # --> take the last part behind the last space to get a filename
-            grep "^-[rwxsSt\-]* " <<< "$LASTINPUT" && dbfile="$(rev <<< \'"$LASTINPUT"\' | cut -d ' ' -f 1 | rev)"
+            grep "[rwxsSt\-]{10,}  " <<< "$LASTINPUT" \
+                && dbfile="$(rev <<< \'"$LASTINPUT"\' | cut -d ' ' -f 1 | rev)"
             echo
   
             sTargetDb=$(guessDB ${dbfile})
             color.print input "New database name [$sTargetDb] >"
             read -r sTargetDb
-            if [ -z $sTargetDb ]; then
+            if [ -z "$sTargetDb" ]; then
                 sTargetDb=$(guessDB ${dbfile})
             fi
             echo
-- 
GitLab