[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash-3 incompatibility: quoting in pattern substitution of variables
From: |
Harald Koenig |
Subject: |
Re: bash-3 incompatibility: quoting in pattern substitution of variables |
Date: |
Mon, 6 Sep 2004 18:15:27 +0200 |
User-agent: |
Mutt/1.4.2.1i |
On Sep 06, Stephane Chazelas wrote:
> On Mon, Sep 06, 2004 at 01:35:49PM +0200, koenig@science-computing.de wrote:
> [...]
> > how to I replace all '?' by ' ' in a shell variable
> > in a _portable_ way which works both in bash-2 and bash-3 ???
> [...]
>
> pattern='\?'
> echo "${variable//$pattern/replacement}"
>
> Seems to work with both versions.
thanks for your quick answer and the workaround !!!
now I'm still curious if my code was (or is) wrong and I have to use
you version in the future, or if bash-3 is buggy and sometime there
will be a fix and my code will work again like with bash-2 ?
again thanks,
Harald Koenig
--
"I hope to die ___ _____
before I *have* to use Microsoft Word.", 0--,| /OOOOOOO\
Donald E. Knuth, 02-Oct-2001 in Tuebingen. <_/ / /OOOOOOOOOOO\
\ \/OOOOOOOOOOOOOOO\
\ OOOOOOOOOOOOOOOOO|//
Harald Koenig \/\/\/\/\/\/\/\/\/
science+computing ag // / \\ \
koenig@science-computing.de ^^^^^ ^^^^^