Date: Tue, 16 Jun 1998 17:41:47 -0600 From: "Michael K. Sanders" <msanders@aros.net> To: Donn Miller <dmm125@bellatlantic.net> Cc: hackers@FreeBSD.ORG Subject: Re: getopt and files that start with - or -- Message-ID: <199806162341.RAA21053@shell.aros.net> In-Reply-To: Your message of "Tue, 16 Jun 1998 19:10:06 -0000." <Pine.NEB.3.96.980616184616.202A-100000@myname.my.domain>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.NEB.3.96.980616184616.202A-100000@myname.my.domain>, Donn Mill er writes: >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(). It's already there. >Say you have a file named --weird.jpg. You want to remove this, so you >do: No, you do 'rm -- --weird.jpg'. Read the getopt(1) man page more carefully: may not be separated from it by white space. The special option ``--'' is used to delimit the end of the options. getopt will place ``--'' in the arguments at the end of the options, or recognize it if used explic- itly. 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?199806162341.RAA21053>