From c948a3d411c7fc0d7a289dba5be3a9ebc991c079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 28 Nov 2009 12:33:08 +0200 Subject: [PATCH] Reuse "esc" more in scp escaping. --- contrib/ssh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/ssh b/contrib/ssh index 73b9e4ea..cc0583fe 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