Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site babel.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!wanginst!vaxine!encore!babel!ptw From: ptw@babel.UUCP Newsgroups: net.bugs.usg Subject: getopt(1) doesn't/can't preserve quoted args Message-ID: <152@babel.UUCP> Date: Mon, 17-Feb-86 12:07:59 EST Article-I.D.: babel.152 Posted: Mon Feb 17 12:07:59 1986 Date-Received: Fri, 21-Feb-86 04:47:02 EST Reply-To: ptw@encore.UUCP (P. Tucker Withington) Distribution: net Organization: Encore Computer Corp. Lines: 18 Keywords: getopt As described in the man page, getopt(1) will erroneously be passed arguments if any contain embedded IFS characters. The correct invocation of getopt should be: set -- `getopt "$@"` to preserve quoted args. Unfortunately, getopt itself does not preserve quoting. The only "legitimate" way I could think of enhancing getopt to preserve quoted args would be for it to single-quote each element of its output string, requiring the following usage: eval set -- `getopt "$@"` Perhaps the re-quoting could be triggered by a quote char in optstring. Q: Does anyone use getopt? Have they run into this problem? Can anyone suggest a better solution?