shell cycle

Hello

I got a cycle in the script which open another scripts.

if [ 1 -lt 3 ]
then
action
fi

Scripts action will be running 2 times at the same time.
Inside of action() is insert into the table.
But what I want is that only first script can do insert into table.

So how to do it?

Thanks

Make a variabe and set to 1 .After that check for a condition and process the script that you want to exec.

If you give a clear spec i can post the code..

1th script looks:
-----------------------------------------------
typeset -i i
i=0
while [ $i -lt 3 ]
do
nohup ./run.sh $1 2>&1 &
i=`expr $i + 1`
done
-----------------------------------------------
And run.sh code:
#!/usr/bin/ksh

sqlplus -s xx/xx@yy <<END
insert into table values ($1);
END
-------------------------------------------------

thats all.