GNU bug report logs - #8420
dirname

Previous Next

Package: coreutils;

Reported by: "Michele Marigliano" <m.marigliano <at> almavivaitalia.it>

Date: Mon, 4 Apr 2011 15:29:01 UTC

Severity: normal

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #13 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Etienne Buira <etienne.buira.lists <at> free.fr>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#8420: dirname
Date: Mon, 4 Apr 2011 18:13:24 +0200
On Mon, Apr 04, 2011 at 03:43:36PM +0200, Michele Marigliano wrote:
> Hi, 

Hi.

> I execute the following bash command on RH 5.3 
> 
> CURRENT_DIR=`/usr/bin/dirname $0`

Beware that it will give the script dirname (if specified), not the
current working directory (that you can get using pwd).

> /usr/bin/dirname: invalid option -- b
> 
> Try `/usr/bin/dirname --help' for more information.
> 
> [oracle <at> mpawls ~]$ /usr/bin/dirname --version
> 
> dirname (GNU coreutils) 5.97

You might want to upgrade, it is an ancient version.

> $ echo $0
> 
> -bash

Options are introduced by a hyphen (which your binary name starts with),
if you want to tell that what follows is not option anymore, you want
to use '--'. So your lines looks like that:
CURRENT_DIR=`/usr/bin/dirname -- $0`
(works at least with coreutils8.7, don't know about your version).

> $ echo $0
> 
> -bash
> 
> $ dirname
> 
> dirname: too few arguments

Yes, it understood it like "dirname -b -a -s -h", whithout any filepath.




This bug report was last modified 14 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.