Date: Tue, 16 Jun 1998 20:53:08 +0000 (GMT) From: Donn Miller <dmm125@bellatlantic.net> To: hackers@FreeBSD.ORG Subject: Re: getopt and files that start with - or -- Message-ID: <Pine.NEB.3.96.980616205159.540A-100000@myname.my.domain> In-Reply-To: <Pine.NEB.3.96.980616184616.202A-100000@myname.my.domain> References: <Pine.NEB.3.96.980616184616.202A-100000@myname.my.domain>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.980616205159.540A-100000>