Here's the BASH code that I currently have

#!/bin/bash
for YEAR in 2003 2004 2005 2006
do
  CMD="./import.php $YEAR"
  $CMD
done

It executes the PHP script once for each of the years in the list.
The PHP script exits with "exit($total);" to have its exit status set to the
number of items it imported.
I would like BASH to trap this value and at the end echo the total of the 4
script executions.

/B


----- Original Message -----
From: "Todd A. Jacobs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 09, 2003 19:39
Subject: Re: Bash Script question


> On Thu, 9 Jan 2003, David Busby wrote:
>
> > How can I get the parent script to capture that return value?  I've been
> > all over the BASH manual (more than one hour) and Google, still no luck.
>
> Not sure what you're really trying to do. If you posted real code, that
> would help.
>
> The exit status of the last command is stored in $?, so:
>
>     for I in 2004 2005
>     do
> ./myscript.php $I
> EXIT_STATUS=$?
>
> # Do something with the value of $EXIT_STATUS
> echo $EXIT_STATUS
>     done
>
> --
> "Of course I'm in shape! Round's a shape, isn't it?"
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to