Paolo Redaelli personal blog

Category: Documentations

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
<span class="pln">find </span><span class="pun">.</span> <span class="pun">-</span><span class="pln">type d </span><span class="pun">|</span> <span class="kwd">while</span><span class="pln"> read file</span><span class="pun">;</span> <span class="kwd">do</span><span class="pln"> echo $file</span><span class="pun">;</span> <span class="kwd">done</span>

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.

<span class="pln">find </span><span class="pun">.</span> <span class="pun">-</span><span class="pln">type d </span><span class="pun">-</span><span class="pln">print0 </span><span class="pun">|</span><span class="pln"> xargs </span><span class="pun">-</span><span class="lit">0</span><span class="pln"> echo </span><span class="str">'The directory is: '</span>

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

To allow or not to allow?

… at my would-be coauthors, would someone please tell them, and every non-native-English-speaker-but-aspiring-English-author, to read this? Please, please, please, please, please. In English the verb “allow” cannot take an infinitive as a complement. Ever. You may not write “my method allows to improve productivity” (even if it’s true, which it probably isn’t, but never mind).…

Gnomes like wine and vinegar

gnome3 – How can I connect to Gnome 3 with a Windows VNC client? Got “rightly” answered on Unix & Linux Stack Exchange Here are some other possible solutions: Disable Vino encryption, and then setup an SSH tunnel Use a VNC client compatible with Vino’s TLS version: Android: bVNC Free, Windows: SSVNC, Linux: vinagre Use…