[ale] bash bug?

michael d. ivey ivey at gweezlebur.com
Mon Dec 13 16:28:03 EST 1999


On Mon, Dec 13, 1999 at 04:02:48PM -0500, Ben Phillips wrote:
> Now, here are my efforts to get rid of it.  As you can see, the last thing I
> tried actually worked, but it makes me curious:  Does this look like a bug
> in bash to anyone else?
> 
> 
> root at localhost# rm -X
> rm: invalid option -- X
> Try `rm --help' for more information.
> root at localhost# rm "-X" 
> rm: invalid option -- X
> Try `rm --help' for more information.
> root at localhost# rm \-X  
> rm: invalid option -- X
> Try `rm --help' for more information.
> root at localhost# rm *X
> rm: invalid option -- X
> Try `rm --help' for more information.
> root at localhost# rm ./-X 
> root at localhost#

from `man bash`:

       GNU  rm,  like every program that uses the getopt function
       to parse its arguments, lets you  use  the  --  option  to
       indicate that all following arguments are non-options.  To
       remove a file called `-f' in the  current  directory,  you
       could type either
              rm -- -f
       or
              rm ./-f
       The Unix rm program's use of a single `-' for this purpose
       predates the development of the getopt standard syntax.

no, it's not a bug. 

    rm -Y

is functionally equivalent to

    rm "-Y"

and to
    
    rm \-Y

because of the way the shell hands the arguments to rm.  rm then
treats them as normal arguments.  `rm ./-Y` is the easiest way, but
sometimes that won't work.  

-- 
-- michael d. ivey, chief thinker  --- <ivey at gweezlebur.com> -----------
------ gweezle bur poetry manufacturing  <http://gweezlebur.com> -------
------------------------------------------------------------------------
"Television!  Teacher, mother, secret lover..."         -- Homer Simpson
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.






More information about the Ale mailing list