🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by David Trueman Tue, 02 Oct 1984 19:56
bug in filename generation in sh(1)
#307
Author: David Trueman
Date: Tue, 02 Oct 1984 19:56
27 lines
1408 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads