Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!david
From: david@utzoo.UUCP (David Trueman)
Newsgroups: net.bugs,net.unix-wizards
Subject: bug in filename generation in sh(1) 
Message-ID: <4406@utzoo.UUCP>
Date: Tue, 2-Oct-84 15:56:18 EDT
Article-I.D.: utzoo.4406
Posted: Tue Oct  2 15:56:18 1984
Date-Received: Tue, 2-Oct-84 15:56:18 EDT
Organization: U of Toronto Zoology
Lines: 27

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