Red Hat Bugzilla – Bug 11822
~ not expanded properly in variable settings when export is used
Last modified: 2008-05-01 11:37:55 EDT
I have bash-2.04-3. Watch this:
> sh -c 'FOO=~/scripts; echo $FOO'
> sh -c 'export FOO=~/scripts; echo $FOO'
> bash -c 'FOO=~/scripts; echo $FOO'
> bash -c 'export FOO=~/scripts; echo $FOO'
In short, ~ is not expanded properly by bash in variable settings preceded
by "export" when bash is invoked as "sh".
This is such a weird bug that I can't believe it isn't somehow intentional,
but on the other hand, I can't imagine why this behavior would be
I've forwarded this to the bash maintainers to make sure it's a bug before
The bash maintainers claim that this is not a bug because the behavior is
required by POSIX, and when bash is invoked as "sh" it runs in POSIX compliant
mode. I think that in this case, the POSIX standard is wrong, but it's unlikely
to change, so I suppose you should go ahead and close this as NOTABUG.
Yes, POSIX compliance is not a bug. ;)