*nix bash while read line do - to proccess all files in a direcotry tree. because i keep forgetting….

I keep forgetting the syntx for while read.

essentially, you pipe a bunch of lines into it, and then it’ll process each line e.g.:

$find ~/video -iname ‘*avi’ -or -iname ‘*mpeg’ | while read movie ; do
mencoder [encoding options...] “$movie” -o ~/converted/`basename
“$movie”` ; done

Yay.

Leave a comment

use html pre or code tags for code