bug in filename generation in sh(1)
David Trueman
david at utzoo.UUCP
Wed Oct 3 05:56:18 AEST 1984
The system 5 sh(1) manual page, in reference to filename generation, states:
[. . .]
Matches any one of the enclosed characters.
A *pair* [my emphasis] of characters separated by `-' matches any
character lexically between the *pair*, inclusive.
This certainly suggests that a `-' at the beginning or end of the set of
characters (`. . .' above) should have no special meaning, since it is
not between a *pair* of characters. However, the code is such that the
`-' is taken to denote a range of characters regardless. If in doubt,
try the following little shell script with an argument of `-', `a' or `z'.
(case pattern matching uses the same logic as filename generation)
case "$1" in
*[-a-z-]*)
echo "Your're OK"
;;
*)
echo "You've got the bug"
;;
esac
Does anyone depend on this behaviour?
--
David Trueman @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!david
More information about the Comp.unix.wizards
mailing list