Paolo Redaelli personal blog

Author: Paolo Redaelli

Link

I find this nice and elegant. The other proposed solutions may handle files with newline in their name, but currently I see such file names as nonsense
find . -type d | while read file; do echo $file; done

However, doesn’t work if the file-name contains newlines. The above is the only solution i know of when you actually want to have the directory name in a variable. If you just want to execute some command, use xargs.

find . -type d -print0 | xargs -0 echo 'The directory is: '

Sorgente: How can I escape white space in a bash loop list? – Stack Overflow

Furthermore BASH Shell: For Loop File Names With Spaces suggets:

find . -print0 | while read -d $'\0' file
do
  echo -v "$file"
done

that should handle even the weirdest file name

Paolo Redaelli

Per monodes.com meglio rirovare i temi Edin o Minamaze.

Realisti di una realtà più grande – OggiScienza

Realisti di una realtà più grande – OggiScienza L’altro pilastro della produzione letteraria di Le Guin è la saga fantasy di Earthsea, composta da cinque romanzi e otto racconti. Un mondo al quale l’autrice era molto legata e al quale è tornata spesso – il primo romanzo, A wizard of Earthsea, è del 1968 mentre…