Fix completion of remote scp filenames with spaces.

Backslash escaping adds 3 backslashes, of which we want to remove 2,
not 4 when unescaping.
This commit is contained in:
Ville Skyttä 2009-11-28 11:57:57 +02:00
parent 3191d14a55
commit ff0f741dcf
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ bash-completion (2.x)
* Apply pine completion to alpine too. * Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist. * Remove many unnecessary short option completions where long ones exist.
* Improve configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer, * Improve configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer,
mysqladmin, service, ssh, and general hostname completions. mysqladmin, service, scp, ssh, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz. * Add abook and wtf completion, based on work by Raphaël Droz.
* Add k3b and lftpget completion. * Add k3b and lftpget completion.
* Don't overwrite other host completions when completing from multiple * Don't overwrite other host completions when completing from multiple

View File

@ -177,7 +177,7 @@ _scp()
userhost=${cur%%?(\\):*} userhost=${cur%%?(\\):*}
path=${cur#*:} path=${cur#*:}
# unescape spaces # unescape spaces
path=${path//\\\\\\\\ / } path=${path//\\\\ / }
if [ -z "$path" ]; then if [ -z "$path" ]; then
# default to home dir of specified user on remote host # default to home dir of specified user on remote host
path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null) path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)