Allow for (more) complex shell commands in parameter

This commit is contained in:
ceriel 1988-04-27 11:30:13 +00:00
parent 7fbb57dea4
commit ccdfd76de2

View file

@ -1,8 +1,8 @@
case $# in case $# in
0) PAR=install ; CMD=Action ;; 0) PAR='make install && make clean' ; CMD=Action ;;
1) PAR="$1" ; CMD=Action ;; 1) PAR="$1" ; CMD=Action ;;
2) PAR="$1" ; CMD="$2" ;; 2) PAR="$1" ; CMD="$2" ;;
*) echo Syntax: "$0" [param [file]] ; exit 1 ;; *) echo Syntax: "$0" [command [file]] ; exit 1 ;;
esac esac
if test -r "$CMD" if test -r "$CMD"
then : then :
@ -21,7 +21,7 @@ do
case x"$1" in case x"$1" in
x!*) ;; x!*) ;;
xname) SYS="$2" xname) SYS="$2"
ACTION='make $PAR' ACTION='$PAR'
DIR=. DIR=.
FM=no FM=no
FAIL='Failed for $SYS, see $DIR/Out' FAIL='Failed for $SYS, see $DIR/Out'
@ -72,7 +72,12 @@ do
else RETC=2 ; eval echo $FAIL else RETC=2 ; eval echo $FAIL
fi ;; fi ;;
*) *)
if eval "$ACTION >Out 2>&1 </dev/null" case "$ACTION" in
'$PAR') ACTION="$PAR"
;;
*) ;;
esac
if eval "{ $ACTION ; } >Out 2>&1 </dev/null"
then eval echo $SUCC then eval echo $SUCC
else RETC=1 ; X=: ; eval echo $FAIL else RETC=1 ; X=: ; eval echo $FAIL
fi fi