bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basename -bash generates an error


From: Brian Matheson
Subject: Re: basename -bash generates an error
Date: Wed, 18 Apr 2007 20:22:54 -0700

Thanks guys, you learn something new every day.

Cheers,
Brian

Eric Blake <address@hidden> 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             address@hidden
> -----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-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]