🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by usenet Wed, 25 Mar 1987 17:49
Re: getopt command problem: doesn't re-quote
#28
Author: usenet
Date: Wed, 25 Mar 1987 17:49
26 lines
1565 bytes
The way getopt is intented to be called, re-quoting would not work.
Getopt is supposed to be invoked as:

	set -- `getopt string $*`

If getopt were to place quotes around arguments containing spaces,
these arguments would still be broken up.  In the first place, they
would be broken up before being passed to getopt.  In the second
place, if this were avoided they would be broken up after getopt
returned.

The solution is to change the way getopt is called to

	eval "set -- `getopt string "$@"`"

Then getopt should be changed to quote not only spaces, but also
other characters special to the shell, such as "$" and "*".  This
quoting should be done by preceding the special characters with
backslashes.

This solution requires that all shell procedures that use getopt
be changed.  Of course these programs fail now on arguments con-
taining white space, but if they are not changed when getopt is
they will fail on arguments containing *any* characters that are
special to the shell.
				Kenneth Almquist
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