deblob-main and cmp

Alexandre Oliva lxoliva at fsfla.org
Tue Mar 31 05:33:08 UTC 2009


On Mar 30, 2009, "Matias A. Fonzo" <selk at dragora.org> wrote:

> Because, $dir is:
> dir=`echo $0 | sed 's,/[^/]*$,,'`

> The value is, dir=deblob-main

Erhm...  I didn't realize it was possible for $0 to not contain a slash.
I always get it started from the PATH, in which case the dir name from
the PATH will be prepended to it, but I've just realized if you run it
like 'sh deblob-main', $0 will be just deblob-main.

I'm replacing this idiom with:

dir=`echo "$0" | sed 's,[^/]*$,,;s,^$,.,;s,/*$,,'`

> Why not the use of "pwd" instead of "echo $0 | sed 's,/[^/]*$,,'"?

Because $0 is not necessarily in the current directory.

What we're looking for is dirname.  If I hadn't some shell portability
craze left from my GNU autoconf and libtool maintainership days, I'd
probably do just that :-)  But the sed snippet above will do.


Can we add Dragora GNU/Linux to the list of 100% Free distros that use
Linux-libre, at the linux-libre.fsfla.org web page?

Regardless, thanks a lot for maintaining another 100% Free distro!
We're a *very* long way from having too many of these :-)

Best regards,

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


More information about the linux-libre mailing list