Originally Posted by ywang016
hi guys I have problems in appending the last number of file into the file.
I wrote the code to read but I dont know how to retrieve the last number which is in the last line
while read line
value=`expr $a+ 1`;
done < "test"
echo final line number is $a;
I'm not quite understanding your problem. Your first sentence sounds like you're trying to cat the last number in the file back into the file (repeating the last line?), while the second sentence sounds like you just want to retrieve the last number in the file.
I'm not sure I understand what your "value" variable is supposed to contain, since it's filled but never used in your script. What about your script is failing?