I am looking for a shell script where counter needs to be set for input paramter and do action once the count reaches to 5. The problem is there could be n number of input parameter and action should also be dependent on time ... Lets suppose if within 60 mins if count reaches upto 5 then which ever action i want to do .......
I found somthing like below but there is no explanation in this programm.....Please help...
#!/bin/sh
COUNTER=0
VALUE="-1"
echo "Enter a series of lines of numbers separated by spaces."
read LIST
IFS=" "
for VALUE in $LIST ; do
eval ARRAY_$COUNTER=$VALUE
eval export ARRAY_$COUNTER
COUNTER=$(expr $COUNTER '+' 1) # More on this in Paint by Numbers
done
# print the exported variables.
COUNTERB=0;
echo "Printing values."
while [ $COUNTERB -lt $COUNTER ] ; do
echo "ARRAY[$COUNTERB] = $(eval echo '$'ARRAY_$COUNTERB)"
COUNTERB=$(expr $COUNTERB '+' 1) # More on this in Paint by Numbers
done
Thanks
