From owner-freebsd-hackers Tue Jun 16 17:57:35 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA04092 for freebsd-hackers-outgoing; Tue, 16 Jun 1998 17:57:35 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from iconmail.bellatlantic.net (iconmail.bellatlantic.net [199.173.162.30]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA04072 for ; Tue, 16 Jun 1998 17:57:23 -0700 (PDT) (envelope-from dmm125@bellatlantic.net) Received: from myname.my.domain (client201-122-36.bellatlantic.net [151.201.122.36]) by iconmail.bellatlantic.net (IConNet Sendmail) with SMTP id UAA06375 for ; Tue, 16 Jun 1998 20:53:06 -0400 (EDT) Newsgroups: comp.unix.bsd.freebsd.misc,comp.os.linux.misc Date: Tue, 16 Jun 1998 20:53:08 +0000 (GMT) From: Donn Miller X-Sender: dmm125@myname.my.domain To: hackers@FreeBSD.ORG Subject: Re: getopt and files that start with - or -- In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 16 Jun 1998, Donn Miller wrote: > Hi > > I had some problems with filenames that start with - or --. The getopt() > library function interprets arguments beginning with "-" passed to > programs like ls, rm, grep as options. This is bad if you try to do > rm -* or > ls -* or grep "a string" -*. I thought maybe a provision could be made to > "ignore the following arguments" passed to getopt(). > > Say you have a file named --weird.jpg. You want to remove this, so you > do: > > rm --* or just --weird.jpg. rm will complain about the invalid option > --weird.jpg, which isn't actually an option but a filename. "ls" will > also complain, as well as other programs using getopt(). So I thought > that maybe getopt could use an option such as ---i or ---ignore to ingore > all other options. Otherwise, you would have to use a program like this > to remove the offending files: > Never mind; I found out that -- signals the end of options. Just didn't read the manpage carefully enough. Donn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message