🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #967

Bug (difference?) in case handling

#967
From: 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
Technical Details
Message-ID: <1992Dec31.141125.13922@Cherniak.ON.CA>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cherniak.on.CA!quenton

Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cherniak.on.CA!quenton
From: quenton@cherniak.on.CA (Dennis Smith)
Subject: Bug (difference?) in case handling
Message-ID: <1992Dec31.141125.13922@Cherniak.ON.CA>
Sender: gnulists@ai.mit.edu
Organization: Cherniak Giblon
Distribution: gnu
Date: Thu, 31 Dec 1992 04:11:25 GMT
Approved: bug-bash@prep.ai.mit.edu
Lines: 34