bug#9450: Bug report on 'dirname' : when jokers match several files
From:
wyrm
Subject:
bug#9450: Bug report on 'dirname' : when jokers match several files
Date:
Wed, 7 Sep 2011 07:10:23 -0700
User-agent:
Mutt/1.5.21 (2010-09-15)
On 2011-09-07 at 09:21:45 +0200, address@hidden wrote:
> Yes, my script doesn't care about the return code. I use the dirname
> to extract the path from a given file, and then do a 'cd' command to
> that path :
> MY_PATH=`dirname $1`
> cd $MY_PATH
> As you say, HP-UX dirname returns 1, but neveetheless outputs the path
> of the first argument, and it's just what I expected him to do ! :))
Place some quotes around the argument, so that the variable will expand
but the glob won't. Something like:
MY_PATH=`dirname "$1"`
will probably do what you expect.
--
Confucius is inscrutable.
God is ineffable.
Beer is inevitable.