bash 3.0 behaves differently ${x/find/replace} with %
Try this:
touch %
[run bash 2]
$ for x in %; do echo ${x/\%/a}; done
%a
$ for x in %; do echo ${x/\\%/a}; done
a
[run bash 3]
$ for x in %; do echo ${x/\%/a}; done
a
$ for x in %; do echo ${x/\\%/a}; done
%
Is this a bug?
I hit this bug because when I rename files downloaded into
/var/cache/apt/archives with an epoch, the : becomes %3a, and I
rename the files and remove that because for some reason it caused
some problem or other with my local archive if I didn't.
The difference is in bash 2 you needed \\% to match a % and in bash 3
you only need \%. Is this "working as intended" or a bug?
I honestly have had a couple beers and the whole thing is pretty much a
mystery to me. Not wasting brain cycles on trivia like this.
Bug or intentional change?
Reply to: