[Bash-completion-commits] [SCM] bash-completion branch, master, updated. e24f69aac34fdfead77fb21fc7367f8776f2d5b2

Ville Skyttä ville.skytta at iki.fi
Sat Nov 28 10:51:20 UTC 2009


The following commit has been merged in the master branch:
commit c948a3d411c7fc0d7a289dba5be3a9ebc991c079
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Nov 28 12:33:08 2009 +0200

    Reuse "esc" more in scp escaping.

diff --git a/contrib/ssh b/contrib/ssh
index 73b9e4e..cc0583f 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -170,10 +170,11 @@ _scp()
 
     _expand || return 0
 
+    # things we want to backslash escape
+    local esc="[][(){}<>\",:;^&\!$=?\`|\\ ']"
+
     if [[ "$cur" == *:* ]]; then
         local IFS=$'\t\n'
-        # things we want to backslash escape
-        local esc="[][(){}<>\",:;^&\!$=?\`|\\ ']"
         # remove backslash escape from :
         cur=${cur/\\:/:}
         userhost=${cur%%?(\\):*}
@@ -218,7 +219,7 @@ _scp()
     # after local file/dir completions, and -o nospace retained for others.
     local IFS=$'\t\n'
     COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* 2>/dev/null | sed \
-        -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \
+        -e "s/$esc/\\\\&/g" \
         -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' -e "s/^/$prefix/") )
 
     return 0

-- 
bash-completion



More information about the Bash-completion-commits mailing list