You're replying to a comment by dj.

December 09, 2013, 18:07

cat file | while... should be avoided. It isn't a like or dislike but is technically different. The pipe creates a subprocess, which has overhead and variable scope issues.

This is only a comment, but it would be better to show them doubled-quoted. The comment might change to an echo and newbies might get the wrong idea. Quoting for splitting, expansion and special characters is probably the biggest gotcha and most misunderstood bash topic.

# do something with $field1, $field2, and $field3
echo do something with "$field1", "$field2", and "$field3"

These should be quoted too, like:
echo $lines
echo $words
echo $chars
echo "$lines"; echo "$words"; echo "$chars"

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "quake3_325": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.