Heinz-Ado Arnolds <[EMAIL PROTECTED]> wrote:
> a=111.1
> echo ${a//[0-9]/x}
>
> correctly gives "xxx.x", but
>
> echo ${a//[0-9]/*}
>
> gives a listing of files in current directory. Seems that the "*"
> is expanded before replacing the pattern.
No, it's expanded afterward, because the variable expansion isn't
quoted. This does what you want:
echo "${a//[0-9]/*}"
> It workes the right way at least up to bash-3.1.17(1)-release
>
> But if you set
>
> a=111
>
> it doesn't even work in 3.1.17 right.
3.1.17 behaves the same way as 3.2.25. You see a different result
because of a different set of files between the two situations, not
because of the different bash version. If there are no files in the
current directory that match ***.*, then pathname expansion will leave
it unchanged.
paul