[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.90-47-g068a1a1

Igor Murzov e-mail at date.by
Thu Nov 17 00:30:01 UTC 2011


On Thu, 17 Nov 2011 00:55:15 +0200
Ville Skyttä <ville.skytta at iki.fi> wrote:

> >> BTW, I suppose the outer quotes are unnecessary, is that incorrect?
> > 
> > Outer quotes are still necessary, they apply to a result, and inner quotes to an argument.
> 
> Sure, but I still don't know of a case where they would be necessary.
> For example, using your previous example values and assignments:
> 
> $ set -x
> $ x="a\ b c\ d e\ f"
> + x='a\ b c\ d e\ f'
> $ y="a\ b"
> + y='a\ b'
> 
> Now, with outer quotes:
> 
> $ z="${x#"$y"}"
> + z=' c\ d e\ f'
> 
> ...and without them:
> 
> $ z=${x#"$y"}
> + z=' c\ d e\ f'
> 
> No difference there...

I don't know if quotes are necessary in this particular case. But with quotes and without quotes results are different:

$ x="a b c"
$ y=a
$ z=( ${x#"$y"} )
$ echo ${#z[@]}
2
$ z=( "${x#"$y"}" )
$ echo ${#z[@]}
1


-- Igor



More information about the Bash-completion-devel mailing list