Re: Bash string substitution bug (?)

2008-01-12 Thread Dmitry V Golovashkin
Thanks a lot! :-) Chet Ramey wrote: Bernd Eggink wrote: Chet Ramey schrieb: Bernd Eggink wrote: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} output: -bash: ${HOSTNAME: bad substitution Apparently bash interprets this as ${parameter

Re: Bash string substitution bug (?)

2008-01-11 Thread Dmitry V Golovashkin
either VALUE=host1.blah.com echo ${VALUE//.*} or echo ${VALUE/.*} is accepted by Bash and works exactly as I would expect it - meaning it correctly produces "host1" - removes the dot (dot is just a character - we are not in the regular expression world) - so the dot and the tr

Re: Bash string substitution bug (?)

2008-01-11 Thread Chet Ramey
Bernd Eggink wrote: Chet Ramey schrieb: Bernd Eggink wrote: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} output: -bash: ${HOSTNAME: bad substitution Apparently bash interprets this as ${parameter/pattern/string} where pattern = ${HOSTNAME. Looks like a bug;

Re: Bash string substitution bug (?)

2008-01-11 Thread Bernd Eggink
Chet Ramey schrieb: Bernd Eggink wrote: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} output: -bash: ${HOSTNAME: bad substitution Apparently bash interprets this as ${parameter/pattern/string} where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. Th

Re: Bash string substitution bug (?)

2008-01-11 Thread Chet Ramey
Bernd Eggink wrote: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME/.*}} output: -bash: ${HOSTNAME: bad substitution Apparently bash interprets this as ${parameter/pattern/string} where pattern = ${HOSTNAME. Looks like a bug; it works in ksh. That is, in fact, what

Re: Bash string substitution bug (?)

2008-01-11 Thread Bernd Eggink
Dmitry V Golovashkin schrieb: Description: unexpected bad substitution: enter the following simple list: prompt: CLUSTER='1 2'; echo ${CLUSTER/${HOSTNAME%%.*}} output: 1 2 the idea of the above line is to remove short HOSTNAME (without the trailing domain) fro

Bash string substitution bug (?)

2008-01-11 Thread Dmitry V Golovashkin
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: x86_64-redhat-linux-gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDI