🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Dennis Smith Thu, 31 Dec 1992 04:11
Bug (difference?) in case handling
#967
Author: Dennis Smith
Date: Thu, 31 Dec 1992 04:11
33 lines
1446 bytes
I am running bash 1.12 and I have found a "difference" in case
handling.  Here is the example:

	case xxx in
	  *"?"*) echo ERROR;;
	esac

This example will echo "ERROR".  I suspect that the the resulting
string within bash after parsing is  *?*  and the quotes are
forgotten.  The quotes (according to /bin/sh) should escape the ? and
make it a simple character.  The 'case' above is looking for the
character "?" in the string "xxx".

If I double escape it:

	case xxx in
	  *"\?"*) echo ERROR;;
	esac

then it does NOT match, but then neither does:

	case "xxx?xxx" in
	  *"\?"*) echo ERROR;;
	esac

which still does NOT echo ERROR.

Given this last example, it appears impossible to look for "?" in a string.
Thus I consider this a bug.  I would prefer it worked like /bin/sh.
-- 
Dennis Smith, quenton@Cherniak.ON.CA, UUCP: ..!lsuc!cherniak!quenton
+1 416 771 7011, FAX +1 416 771 6288
Cherniak Giblon 10 Commerce Valley Dr. E. #400, Thornhill, Ont. CANADA L3T 7N7
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