Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Umount completion fails when mount point or dev node contains spaces
- X-seq: zsh-workers 20769
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Umount completion fails when mount point or dev node contains spaces
- Date: Tue, 1 Feb 2005 10:57:32 +0000
- In-reply-to: <87d5vl6qf1.fsf@xxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <87d5vl6qf1.fsf@xxxxxxxxxxxxxxxx>
On Mon, Jan 31, 2005 at 05:05:06PM -0800, Philippe Troin wrote:
[...]
> # umount /mnt/mount\\040point\[\\134
>
> The enclosed patch takes care of the problem by unescaping octal
> sequences.
>
[...]
> + dev_tmp=(${dev_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])})
Note that this would fail for foo\012bar
for ((i = 1; i <= $#dev_tmp; i++)); do
eval "dev_tmp[i]=\$'${dev_tmp[i]}'"
done
should work and avoid the forks for $(print ...)
$ sudo mkdir '/mnt/f\n\1oo
quote> bar'
~$ sudo mount --bind /tmp $_
~$ tail -1 /etc/mtab
/tmp /mnt/f\134n\1341oo\012bar none rw,bind 0 0
~$ dev_tmp=('/mnt/f\134n\1341oo\012bar')
~$ print -rl -- ${dev_tmp//(#b)(\\([0-7]##|\\))/$(print $match[1])}
/mnt/f\n\1oobar
~$ dev_tmp=('/mnt/f\134n\1341oo\012bar')
~$ for ((i = 1; i <= $#dev_tmp; i++)); do
for> eval "dev_tmp[i]=\$'${dev_tmp[i]}'"
for> done
~$ print -rl "${(@)dev_tmp}"
/mnt/f\n\1oo
bar
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author