[patch] zip tests
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Wed May 7 07:53:09 UTC 2008
On Tue, 6 May 2008, Paul Smith wrote:
> On Wed, 2008-05-07 at 00:36 +0200, Cristian Ionescu-Idbohrn wrote:
> > > xtrace=$(set -o | sed -rne 's/xtrace[[:space:]]+([^[:space:]]+)/\1/p')
> > > [ "$xtrace" = off ] || set +x
> > >
> > > eval "$2" >t_actual 2>&1 || {
> > > echo "$1: FAIL (eval)"
> > > }
> > >
> > > [ "$xtrace" = off ] || set -x
>
> This seems really heavy-weight to me, especially if it's run once per
> test! Why not something simpler, like:
>
> case $- in
> *x*) xtrace=true ;;
> *) xtrace=false ;;
> esac
>
> set +x
>
> eval "$2" >t_actual 2>&1 || {
> echo "$1: FAIL (eval)"
> }
>
> $xtrace && set -x
Good observation Paul. Still. Are 'true' and 'false' builtins?
Wouldn't this:
---8<---
#!/bin/sh
set -e
echo "### do some stuff here ###"
case $- in
*x*)
xtrace=y
;;
*)
xtrace=n
;;
esac
set +x
echo "*** do the eval here ***"
[ $xtrace = n ] || set -x
echo "### do some more stuff here ###"
exit 0
---8<---
be even lighter on resources?
Cheers,
--
Cristian
More information about the busybox
mailing list