I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Friday, 25 April 2014

for loop with spaces

I used to use a "for"-loop over a result of a `cat file` in order to apply on each line. But this does not work very well with spaces... Therefore I looked for a better solution which I kept forgetting. The trick is to use the "read command a in the example below:
find ... | while read -r dir
do
    something with "$dir"
done