In bash, code like this will read each line in a file one at a time:
while IFS=$'\r' read -r line || [[ -n "$line" ]]; do something done < "to-read-file"
When the code is running, as long as it hasn't reached the final line of the to-read-file, I can add lines to the end of the to-read-file and the code will continue working on new added lines.
I need your help for a similar code in csh. Currently the code I am using under csh is like this:
foreach line (cat to-read-file) (do things) end
It will read all the lines at once. Once the code is running, the new lines added to the to-read-file will not be read. Any idea how I can make it read the line once at a time? For some reason I have to work under csh for this case.
Thank you very much.