🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by usenet Fri, 13 Mar 1987 15:12
getopt command problem: doesn't re-quote
#27
Author: usenet
Date: Fri, 13 Mar 1987 15:12
19 lines
1218 bytes
Don't know if anyone's brought this up before, but the getopt command seems to 
have a bit of a problem.  It doesn't "re-quote" arguments, so they get broken
up incorrectly when parsed by the shell.  

Example:	 getopt x: -x "a test"
produces:	-x a test --
instead of:	-x "a test" --
Resulting in:  			Instead of:
		$1=-x 			$1=-x
		$2=a 			$2=a test
		$3=test 		$3=--
		$4=--

Even "sh" itself recognizes this problem, and provides re-quoting via "$@" .

Since writing one's own getopt program is trivial on a system with the getopt
call, this is more of a major annoyance than a problem.  So, my questions:
1)  Any portable workarounds (I can't think of any)?
2)  Have any of the standards groups thought of proposing that this be fixed?
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