Hello Chet,
hello list,
during some discussion in the IRC #bash channel on freenode we found a
weird behaviour of the 'hash' builtin command.
The command exits true if the operand in question contains a /, no
matter if that makes sense or not:
---
$ hash
'CHANGELOG_CURRENT="http://slackware.osuosl.org/slackware-current/ChangeLog.txt"';
echo $?
0
---
---
$ hash 'meow/foo/baz'; echo $?
0
---
This alone is weird enough. When you add the -t option (if available) to
print the pathname, it fails:
---
$ hash -t
'CHANGELOG_CURRENT="http://slackware.osuosl.org/slackware-current/ChangeLog.txt"';
echo $?
bash: hash:
CHANGELOG_CURRENT="http://slackware.osuosl.org/slackware-current/ChangeLog.txt":
not found
1
---
---
$ hash -t 'meow/foo/baz'; echo $?
bash: hash: meow/foo/baz: not found
1
---
This happens on a 2.04 (no -t option to check the other case) aswell as
on a 4.1.
If this is not a bug, what's the reason behind this? Is it to blindly
report success when an operand "looks like a pathname"?
Regards,
Jan "TheBonsai"