bug-coreutils
[Top][All Lists]
Advanced

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

bug#8420: dirname


From: Etienne Buira
Subject: bug#8420: dirname
Date: Mon, 4 Apr 2011 18:13:24 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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.
> 
> address@hidden ~]$ /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.





reply via email to

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