I realize I could do this in any other language - but with Bash - I've looked far and wide and could not find the answer.
I need to manually increase $line in a script: Example:
for line in `cat file`
do
foo()
foo_loop(condition)
{
do_something_to_line($line)
}
done
If you notice, every time the foo_loop iterates, $line stays the same. I need to iterate $line there, and make sure the original for loop only runs the number of lines in file.
I have thought about finding the number of lines in file using a different loop and iterating the line variable inside the inner loop of foo().
Any ideas?