> 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?

and if so, one could use $PWD.

 : ${tsdir:=$PWD}
 : ${bindir:=${PWD%/*}}

paul
=---------------------
 paul fox, [EMAIL PROTECTED]
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to