Shell programming: Iterate through the results of find

Posted on

Iterate through the results of find without messing around with IFS

For my own reference really.

find $in_dir -type f -name "*.cpp" -print0 | while read -d $'\0' file
    @echo "$file"

Not done much in the way of shell programming before, I'd usually use something like Ruby for this kind of thing. Unfortunately I'm becoming increasingly intolerant of boot up time cost for tiny shell scripts so I'm having a dabble with something quicker.

Initial impressions are it's quite antiquated; overly fussy syntax and doing . That aside though it's also plenty powerful and with a bit of effort you can do most things and yep, it's very quick.