GNU bug report logs -
#8420
dirname
Previous Next
Full log
View this message in rfc822 format
Ooopss....
-----Messaggio originale-----
Da: Michele Marigliano [mailto:m.marigliano <at> almavivaitalia.it]
Inviato: lunedì 4 aprile 2011 18.32
A: 'Eric Blake'
Oggetto: R: bug#8420: dirname
Thanks for your reply.
I agree with you, but I was installing some software on RH 5.3 and when I
was going to run a script it exit soon because its first line
(CURRENT_DIR=`/usr/bin/dirname $0`) was in error.
So I copyed that line in an interactive bash shell ad I noticed that
$ CURRENT_DIR=`/usr/bin/dirname $0`
/usr/bin/dirname: invalid option -- b
In a bash script $0 should be script name, so I didn't understand why it
didn't work.
In anycase I tried that line also on Centos 5.5 with same error, of course,
but when I tried it on RH 4.x it didn't report any error.
This was a quite strange, I thought, so I have reported you it to know if
this behavior is all right.
At end, I resolved it running the script in this way:
./script.sh
and NOT
. script.sh (my first run with error).
Bye
Michael
PS: sorry for my bad English.
-----Messaggio originale-----
Da: Eric Blake [mailto:eblake <at> redhat.com]
Inviato: lunedì 4 aprile 2011 18.02
A: Michele Marigliano
Cc: 8420-done <at> debbugs.gnu.org
Oggetto: Re: bug#8420: dirname
tag 8420 + invalid
thanks
On 04/04/2011 07:43 AM, Michele Marigliano wrote:
> Hi,
>
>
>
> I execute the following bash command on RH 5.3
>
> CURRENT_DIR=`/usr/bin/dirname $0`
>
> /usr/bin/dirname: invalid option -- b
Thanks for the report. However, this is not a bug in dirname, but in your
usage pattern. You are invoking "dirname -bash", which dirname
(rightly) interprets as the attempt to be the -b option, but dirname does
not have a -b option. You need to use -- to mark the end of options and the
start of arguments:
dirname -- "$0"
> dirname (GNU coreutils) 5.97
Wow, that's old. The latest stable version is 8.10.
> $ /usr/bin/dirname --version
>
> dirname (GNU coreutils) 5.2.1
Wow, that's even older, but same story.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
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.