4 ms·
false $ ls -Ql totale 4 -rw-r--r-- 1 zed users 33 set 6 07:30 " spaces " $ $ find -name '*spaces*' | while read text; do cat
by _ZeD_ 14y ago
false
$ ls -Ql
totale 4
-rw-r--r-- 1 zed users 33 set 6 07:30 " spaces "
$
$ find -name '*spaces*' | while read text; do
cat "$text";
done
cat: ./ spaces: File o directory non esistente
$
$ find -name '*spaces*' -print0 | xargs -0 cat
while read is broken with spaces
$
- mkl 14y agoOnly for file names starting or ending with spaces, as far as I can tell, which are pretty unusual.
- ralph 14y agoIFS needs some care and attention and read should have -r. $ ls -Q " spaces " $ ls | while IFS="\n" read -r f; do ls "$f"; done spaces $ For lots of grim detail see David A. Wheeler's http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html http://www.dwheeler.com/essays/fixing-unix-linux-filenames.h...
- BrandonM 14y agoThat is a good point, but it is a much more degenerate case than the more common internal space.