]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Fix: proper parameter handling in ssh/rsync actions
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 2 Nov 2024 19:00:04 +0000 (16:00 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 2 Nov 2024 19:00:04 +0000 (16:00 -0300)
kvmx

diff --git a/kvmx b/kvmx
index a2578d899a44d8db20bbf7988a8bd7c61690969d..e4d1cd941ee39d9e8b1fed7ea4890a22396bd0f6 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -1007,15 +1007,15 @@ function kvmx_sshdir {
     #exit 1
   fi
 
-  DEST="$1"
+  DEST="$*"
 
   # Defaults to the current folder
   if [ -z "$DEST" ]; then
     DEST="`pwd`"
 
     # Fix ~/ path
-    if echo $DEST | grep -q -e "^$HOME"; then
-      DEST="$(echo $DEST | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
+    if echo "$DEST" | grep -q -e "^$HOME"; then
+      DEST="$(echo "$DEST" | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
     fi
   fi
 
@@ -1405,8 +1405,8 @@ function kvmx_rsync_to {
   fi
 
   # Fix ~/ path
-  if echo $DEST | grep -q -e "^$HOME"; then
-    DEST="$(echo $DEST | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
+  if echo "$DEST" | grep -q -e "^$HOME"; then
+    DEST="$(echo "$DEST" | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
   fi
 
   SSH="`cat $SSHFILE`"
@@ -1442,8 +1442,8 @@ function kvmx_rsync_from {
   fi
 
   # Fix ~/ path
-  if echo $ORIG | grep -q -e "^$HOME"; then
-    ORIG="$(echo $ORIG | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
+  if echo "$ORIG" | grep -q -e "^$HOME"; then
+    ORIG="$(echo "$ORIG" | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
   fi
 
   SSH="`cat $SSHFILE`"
@@ -1474,8 +1474,8 @@ function kvmx_scp_from {
   fi
 
   # Fix ~/ path
-  if echo $ORIG | grep -q -e "^$HOME"; then
-    ORIG="$(echo $ORIG | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
+  if echo "$ORIG" | grep -q -e "^$HOME"; then
+    ORIG="$(echo "$ORIG" | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
   fi
 
   SSH="`cat $SSHFILE`"
@@ -1506,8 +1506,8 @@ function kvmx_scp_to {
   fi
 
   # Fix ~/ path
-  if echo $DEST | grep -q -e "^$HOME"; then
-    DEST="$(echo $DEST | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
+  if echo "$DEST" | grep -q -e "^$HOME"; then
+    DEST="$(echo "$DEST" | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
   fi
 
   SSH="`cat $SSHFILE`"