Damien Nadé wrote:
I've tried to insert a single quote into a variable content. With something like this :
bash-3.2$ foo=bar
bash-3.2$ echo "${foo/%/'}"
>
If you look at that, you understand that > is the $PS2, so it means that
bash is interpreting the single quote a special char.

So, naturally, I've told myself : "just escape it". And I've tried
that :

bash-3.2$ foo=bar
bash-3.2$ echo "${foo/%/\'}"
bar\'

But... what the hell ? The backslash belongs to the variable now ?
So, I cant use it "as is", and if I escape it, the command doesnt do
what I want anymore..

Is that some kind of bug in the parser ?

Hmm... that seems to be a good question. Meanwhile, you can do this:
$ foo=bar
$ q="'"
$ echo "${foo/%/$q}"
bar'

--
Matthew
FOSS: Giving people the cage and it's blueprints, gratis. The "L" matters.



Reply via email to