You're replying to a comment by Dave Eddy.

June 08, 2012, 10:48

Great post, you covered awesome stuff, and unlike most bash tips, you actually understand bash and all the gotchas it has.

One quick note on #4, where you cat the file and | into while read line, be careful with this approach. The while loop is now created in a subshell, so any variables modified within the context of the while loop will not persist when the loop exits.

ex. (let's say foo.txt has 10 lines)

cat foo.txt | while read line; do ((i++)); done
echo "$i"

will print 0.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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