Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!mcdchg!usenet From: usenet@mcdchg.UUCP Newsgroups: mod.os.unix Subject: Re: getopt command problem: doesn't re-quote Message-ID: <278@mcdchg.UUCP> Date: Wed, 25-Mar-87 12:49:20 EST Article-I.D.: mcdchg.278 Posted: Wed Mar 25 12:49:20 1987 Date-Received: Fri, 27-Mar-87 04:27:18 EST Sender: usenet@mcdchg.UUCP (Usenet Admin) Lines: 26 Approved: usenet@falkor.UUCP Summary: Problem is with how getopt is called. 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