[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8575: basename [was: bug#8575: Shell Script in Red Hat Enterprise Li
From: |
Eric Blake |
Subject: |
bug#8575: basename [was: bug#8575: Shell Script in Red Hat Enterprise Linux Server release 5.5 (Tikanga)] |
Date: |
Thu, 28 Apr 2011 07:58:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9 |
retitle 8575 basename usage question
tag 8575 notabug
thanks
On 04/28/2011 02:42 AM, Syed Nizamuddin wrote:
> Hi,
>
> I get the following error .
>
> basename: invalid option -- b
> Try `basename --help' for more information.
> basename: missing operand
Thanks for the report. However, this is not a bug in basename, but in
your usage.
>
> I have basename used as
>
> CMDE=`\basename $0 .sh`
That's your problem. $0 expanded to "-bash", so basename is trying to
parse -b as an option. Instead, use:
basename -- "$0" .sh
to avoid issues with $0 having a leading '-'. If you want to do more
reading about this topic, see a similar report about dirname:
http://debbugs.gnu.org/8420
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature