debug this script

echo "input time in hhmmss"
read $st
h=`echo $st | cut -c1-2`
min=`echo $st | cut -c3-4`
s=`echo $st | cut -c5-6`
echo "input  time in hhmmss"
read $end
h1=`echo $end | cut -c1-2`
min1=`echo $end | cut -c3-4`
s1=`echo $end | cut -c5-6`
x= `expr  $h /* 60 + $min`
y= `expr  $h1 /* 60 + $min1`
z= `expr  $y - $x`
for i in `seq 1 $z`
do
cat test | grep "$h$min" >> /home/barmecha/file1
$min=`expr $min + 1`
if test [ $min -eq 60 ]
then
$h=`expr $h + 1`
fi
done

this is a script to extract data from a logfile for a particular date and time but gives some err in line no. 11,12,13,14 i guess it has some problem with expr command and seq.

Remove all spaces.

it doesn,t work even then also......

x= `expr  $h /* 60 + $min`
y= `expr  $h1 /* 60 + $min1`
z= `expr  $y - $x`

Remove the spaces that follow the = and change / to \.

Remove the space after the = and use backslash in place of forward slash.

Thanks
Namish

The arithmentic on the dates will give you grief in the final "grep". Where hours and/or minutes fields are less than value 10, you will then need to convert integers with no leading zeros to strings with leading zeros.
If your intention is to find all entries in the log between two times (hour and minute on the same day) inclusive, the value of $z needs to be incremented by one.
The seconds fields ($s and $s1) appear to be surplus - the script as presented only needs the start and end times in hours and minutes.
I guess that "seq" is a program or enhanced shell function to generate numbers in a range. It is not a Bourne or Korn shell function. Beware that you could easily generate a command line which is too long by this method.

Alternative?
You could restructure the script to not do arithmetic on dates. Consider this simple example script "test2.sh" to process file "test2.txt" to extract lines between 0201 and 0203 inclusive using only character strings:

=======
test2.txt

0101
0102
0103
0201
0202
0203
0301
0302
0303

======
test2.sh

cat test2.txt|while read MMDD
do
if [ "${MMDD}" -ge "0201" -a "${MMDD}" -le "0203" ]
then
echo "${MMDD}"
fi
done

=======
Execution

# . ./test2.sh
0201
0202
0203

This method still needs enhancement to prevent false matches from grep when there is more than the 4 characters on a line! The exact layout of the logfile records and the position of the date on each line will dictate how write a script to do this match.

namish thanks for ur contribution....
the for loop in the above code also have some problem in it..plz check it..
try while loop instead and if it works ...revert back it to me

the script runs properly without any err but i am facing one more problem i.e. the hour (h)doesnt incrementing as min = 60, as written in the if condition ..plz chek it

the script runs properly without any err but i am facing one more problem i.e. the hour (h)doesnt incrementing as min = 60, as written in the if condition ..plz chek it