mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Belisko Marek <marek.belisko@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH] Make MAKEALL a bash script
Date: Mon, 2 May 2011 11:50:58 +0200	[thread overview]
Message-ID: <20110502095058.GD31131@pengutronix.de> (raw)
In-Reply-To: <20110502094101.GC31131@pengutronix.de>

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@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@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@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/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-05-02  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29  7:06 MAKEALL problem Belisko Marek
2011-04-29  8:25 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-29  8:47   ` Belisko Marek
2011-04-29  9:30     ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-29  9:42       ` Belisko Marek
2011-04-29 18:38       ` Belisko Marek
2011-05-02  9:27         ` Uwe Kleine-König
     [not found]           ` <BANLkTinr-veuyxksGrtbk3o49-Pcc1uY-g@mail.gmail.com>
2011-05-02  9:41             ` Uwe Kleine-König
2011-05-02  9:50               ` Uwe Kleine-König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110502095058.GD31131@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=marek.belisko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox