i hava a command expr... where i m adding a value in a loop
like
Tc=`expr $Tc\+ $l`
where
Tc is declred as a variable and every time l contains a new vaue
if
Tc =0 initially
and l =2
Tc should be equal to 0+ 2
and then
l = 4
Tc = 2+4
and dispaly as 6
but after on iteration it is not adding up the value...
Do not do that. Not only is ls unnecessary and slow, but it will break your script if there are any spaces or other pathological characters in any filenames.
Use:
for i in q*.txt
You reset $tc to 0 on every iteration of the loop. Set it before the loop.