bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

backslash required for [\/]


From: jidanni
Subject: backslash required for [\/]
Date: Sat, 25 Dec 2010 20:30:27 +0800

I have discovered yet another bug in your "bash" program.

First we see how a normal program, trusty sed, deals with [ ]:
$ r=abaabbbbbdddd; echo $r|sed 's/[:?/ba]/u/g'
uuuuuuuuudddd

Now we try "bash":
$ r=abaabbbbbdddd; echo ${r//[:?/ba]/u}
abaabbbbbdddd
$ r=abaabbbbbdddd; echo ${r//[:?\/ba]/u}
uuuuuuuuudddd

Observe how a backslash is required, else the program doesn't "fire".

It's as if it is totally unaware that it is already inside the [ ].

And if the backslash was really required, then why doesn't it "blow up"
if we remove it?

While we are here, here's another interesting phenomena,
$ touch aa
$ echo a[ab]
aa
$ echo a[ab/]
a[ab/]
$ echo a[ab\/]
a[ab/]
$ mkdir ab #doesn't help...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]