From owner-freebsd-hackers Tue Jun 16 16:41:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA20529 for freebsd-hackers-outgoing; Tue, 16 Jun 1998 16:41:59 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mars.aros.net (mars.aros.net [207.173.16.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA20524 for ; Tue, 16 Jun 1998 16:41:53 -0700 (PDT) (envelope-from msanders@shell.aros.net) Received: from shell.aros.net (root@shell.aros.net [207.173.16.19]) by mars.aros.net (8.8.7/8.8.4) with ESMTP id RAA10117; Tue, 16 Jun 1998 17:41:44 -0600 (MDT) Received: from shell.aros.net (msanders@localhost.aros.net [127.0.0.1]) by shell.aros.net (8.8.7/8.8.5) with ESMTP id RAA21053; Tue, 16 Jun 1998 17:41:47 -0600 (MDT) Message-Id: <199806162341.RAA21053@shell.aros.net> X-Attribution: msanders To: Donn Miller cc: hackers@FreeBSD.ORG Subject: Re: getopt and files that start with - or -- In-reply-to: Your message of "Tue, 16 Jun 1998 19:10:06 -0000." X-Mailer: MH 6.8.3 Date: Tue, 16 Jun 1998 17:41:47 -0600 From: "Michael K. Sanders" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message , 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