Hi ,
I am trying to write a script in kshell with while loop ,its like
count=1
count_cmp=1
while [ $\{count\} -le $\{file_length\} && $\{count_cmp\} -le $\{count\} ]; do
tail -$count tempfile | head -1 > tempstring
.......
done
However i get CIF.sh: line 33: [: missing `]'
I have checked thetrailing spaces , not sure what is wrong here
Sorry
i even tried with
count=1
count_cmp=1
while [ $\{count\} -le $\{file_length\} && $\{count_cmp\} -le $\{count\} ]
do
-----
done
still the same error
chella
3
Hi Amit,
Before answering your question, I have a suggestion for you. If you post the scripts please use the code tags available.
Try this,
while [ ${count} -le ${file_length} ] && [ ${count_cmp} -le ${count} ];
Each condition in the while loop or if loop should be marked with [ ].
Regards,
Chella
Thanks a lot Chella , it works !!
aigles
5
Another way :
while [ ${count} -le ${file_length} -a ${count_cmp} -le ${count} ]
Jean-Pierre.