[getopt-sig] ANNOUNCE: Optik 1.3 released

David Boddie david@sleepydog.net
Mon, 15 Apr 2002 14:16:45 +0100


On Monday 15 Apr 2002 1:00 pm, A.T. Hofkamp wrote:

> On Sat, 13 Apr 2002, Greg Ward wrote:

> > > are "greedy" (they try to take an argument first), or "non-greedy" (try
> > > to match options first).  But what if you then want to pass an option
> > > argument which begins with a hyphen, like a file named "-dash.txt"? 
> > > Doesn't work.
>
> A known problem with rm, i.e. 'rm -myfile' will not be accepted by the
> standard rm (maybe 'rm -- -myfile' would work on GNU-rm).

That's a good example. Generally, interpreting whether an argument is
an option or not requires some idea of the context.

> Standard trick around it is 'rm ./-myfile'.
>
> The core of the problem is of course that a user cannot get around the
> hard-coded meaning of '-', but I wouldn't know how to get around that
> (unless we introduce a work-around with a new environment variable
> 'OPTIONCHAR').

Can't you write the following?

  rm "-myfile"

> I don't think we want to change that, these limitations are more or less
> intrinsic in Unix. In the same way as / is hard-coded as directory
> seperator.

People can work around the use of a dash to denote an option. Directory
separators aren't common across platforms, so are defined by os.sep.

David

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________