just another one of my rumblings
Bernhard Fischer
rep.dot.nop at gmail.com
Thu Apr 24 21:30:21 UTC 2008
On Thu, Apr 24, 2008 at 04:30:48PM -0400, Paul Fox wrote:
> > On Thu, 2008-04-24 at 21:09 +0200, Cristian Ionescu-Idbohrn wrote:
> > > [ -n "$bindir" ] || bindir=$(dirname $(pwd))
> >
> > Even better is to avoid dirname altogether. It's actually not necessary
> > at all in a POSIX shell; neither is basename.
> >
> > The above can be rewritten much more efficiently as:
> >
> > pwd=$(pwd)
> > : ${tsdir:=$pwd}
> > : ${bindir:=${pwd%/*}}
> >
> > Just sayin'... :-)
> >
> > I'm assuming this script is declared #!/bin/bash at the top, due to all
> > the bashisms it uses?
If it is then it should be fixed to work with about the minimal shell we
provide (for self-tests and for consistency).
I did fix the scripts some time ago, but back then, Rob reverted it
immediately. Now would be a good time to fix it up for good.
>and if so, one could use $PWD.
>
> : ${tsdir:=$PWD}
> : ${bindir:=${PWD%/*}}
More information about the busybox
mailing list