Hi,
in a previous mail I asked for a way to replace $<variable> with
${<variable>} in shell scripts.
One suggested solution was to apply the following to the script
:%s/\$\zs\(\w\+\)/{\1}/gc
which works nicely.
Now I wanted to extend the above expression to also change
$-expressions in my shell scripts like
$#<arrayvar>
$?
$*
$@
...and so on. So I changed (just for a test first) the above
expression with
:%s/\$\zs\([\w]\+\)/{\1}/gc
(added [] around \w) which -- as far as I know (and it seems, that
this isn't enough in this case... ;) -- does not change anything,
since it simply says: one or more of the itenms in the []s -- and the
only item is a word-character.
But suddenly nothing was matched anymore....
My "final" approach was this one:
:%s/\$\zs\([\w\#\$\*\?]\+\)/{\1}/gc
but ....
What did I wrong here ?
Thank you very much for any help in advance !
Have a nice weekend!
mcc