[Bash-completion-devel] [SCM] bash-completion branch, master, updated. 1.90-47-g068a1a1
Ville Skyttä
ville.skytta at iki.fi
Thu Nov 17 06:19:05 UTC 2011
On 11/17/2011 02:30 AM, Igor Murzov wrote:
> 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
Yes, for array constructs like that they are needed to protect
whitespace, that I know.
$ x="a b"
$ y=( $x )
$ for (( i=0; i < ${#y[@]}; i++ )); do echo "$i:'${y[i]}'"; done
0:'a'
1:'b'
$ y=( "$x" )
$ for (( i=0; i < ${#y[@]}; i++ )); do echo "$i:'${y[i]}'"; done
0:'a b'
But I'm not aware of a case where they're needed for normal variable
assignments.
More information about the Bash-completion-devel
mailing list