Last question:
you may start with 'Linux Hands on Guide', you can find it on tldp.org; it's not specifically about shell scripting, but has useful exercises at the end of each chapter that may be useful for you.
see ya
fra
---------- Post updated at 14:55 ---------- Previous update was at 14:55 ----------
Answer to first question:
$i gets the value of the first word (that is, set of contiguous, non space-interleaved characters) in the file.
in order to loop you don't have to modify $i. $i in the specific example is not a counter.
Second question: it' not very clear to me what are the starting conditions (what are the input data or files).
If we are working with lines, we do not want to expand the entire file "abc.txt" on the "for" line and then read it word by word.
We need to read each line one-by one with a method which preserves the record construct.
cat abc.txt | while read line
do
echo "${line}" # Display line
done
To make the extra read in the while loop:
cat abc.txt | while read line
do
echo "${line}" # Display first line and every odd-numbered line
read line # Read even numbered lines
echo "${line}" # Display 2nd line and every even-numbered line
done
Don't understand your second question. Not clear which file is which or what the process is.