Hi,
I am using bash shell's extended pattern matching.
What tweak the following code needs in order to get the expected output?
shopt -s extglob
f="a@b@_c@d@_e"
echo "${f/@(@|@_)/__}"
My expected output is:
a__b__c__d__e
but the actual output is:
a__b@_c@d@_e
# that is, how to make the change global as like echo $f | sed 's/@\|@_/__/g'
bash's extended pattern matching only works on filename expansion, not on parameter expansion.
In bash parameter expansion, do we have any such syntax as below?
echo "${!var*}"
consider, var is a variable previously set to some arbitrary string value
What do you want it to do?
I suggest that you read the Parameter Expansion section of the bash man page.