18
Jul/08
0

*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.

Tagged as: ,
Close
E-mail It
Socialized through Gregarious 42