[PATCH] Make MAKEALL a bash script
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Mon May 2 05:50:58 EDT 2011
MAKEALL uses the array PIPESTATUS which is a bash extension. A
replacement isn't available in other common shells (e.g. dash which
provides /bin/sh in Debian since at least Squeeze (6.0))
While at it, use . instead of source which is another bashism. Not
necessary any more, but there is no need to use a bash extension if
there is a generic way, too.
Reported-by: Belisko Marek <marek.belisko at gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
On Mon, May 02, 2011 at 11:41:01AM +0200, Uwe Kleine-König wrote:
> Hello,
>
> On Mon, May 02, 2011 at 11:33:37AM +0200, Belisko Marek wrote:
> > 2011/5/2 Uwe Kleine-König <u.kleine-koenig at pengutronix.de>:
> > >
> > > Maybe instead use
> > >
> > > -#!/bin/sh
> > > +#!/bin/bash
> > IMO this is not generic solution.
> > Because debian based distros has dash by default
> > in /bin/sh this users must always change MAKEALL script?
> Even Debian users should have a bash in /bin/bash though. At least I
> have :-) Either you or me has a misunderstanding.
BTW, just doing
- for i in "${PIPESTATUS[@]}"
+ for i in ${PIPESTATUS}
doesn't work:
$ false | cat
$ echo ${PIPESTATUS}
So the problem is not that PIPESTATUS isn't an array in dash (which
doesn't support arrays at all), but PIPESTATUS just doesn't exist.
Best regards
Uwe
diff --git a/MAKEALL b/MAKEALL
index e987de2..2de5700 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/bash
# Print statistics when we exit
trap exit 1 2 3 15
@@ -234,7 +234,7 @@ then
CONFIG="./${CONFIG}"
fi
- source "${CONFIG}"
+ . "${CONFIG}"
fi
[ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the barebox
mailing list