[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils-bug
Subject:    Re: basename -bash generates an error
From:       Brian Matheson <bmath () xsigo ! com>
Date:       2007-04-19 3:22:54
Message-ID: 25621.1176952974 () red ! xsigo ! com
[Download RAW message or body]


Thanks guys, you learn something new every day.

Cheers,
Brian

Eric Blake <ebb9@byu.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to Brian Matheson on 4/18/2007 8:34 PM:
> > Old behavior:
> > red:~$ basename $0
> > -bash
> 
> Broken.
> 
> > 
> > New behavior:
> > orange:~/lib/sh$ basename $0
> > basename: invalid option -- b
> > Try `basename --help' for more information.
> 
> Correct behavior, but undesired results.
> 
> So what you really wanted to do:
> 
> basename -- "$0"
> 
> This correctly handles the case when $0 contains shell metacharacters, as
> well as when it starts with -.
> 
> > 
> > Looks like a misbehavior in option parsing.
> 
> No, just a misunderstanding on your part.  POSIX requires the current
> behavior.
> 
> - --
> Don't work too hard, make some time for fun as well!
> 
> Eric Blake             ebb9@byu.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGJtzR84KuGfSFAYARAi9SAKC1lELw/+J6mLYBQ8hyIRcOAwWn9ACg1apm
> cs2wFv7zfGaZDV95JD6nxYc=
> =79ow
> -----END PGP SIGNATURE-----



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic