LINUX.ORG.RU

История изменений

Исправление Eddy_Em, (текущая версия) :

Кстати, а и правда, что скажет твой скрипт на такое:

ls
.  ..  file with spaces  file with spaces 2  file with spaces 3  file with spaces and \'apostrophes\'  file with spaces and "quotations"

Простой find на апострофы матюкается:

find . -maxdepth 1 -name "*file*" |while read F; do ls "$F"; done
ls: невозможно получить доступ к ./file with spaces and 'apostrophes': Нет такого файла или каталога
./file with spaces and "quotations"
./file with spaces 3
./file with spaces 2
./file with spaces

А вот так — ВР:

find . -maxdepth 1 -name "*file*" -print0 | xargs -I{} -0 ls {}
./file with spaces and \'apostrophes\'
./file with spaces and "quotations"
./file with spaces 3
./file with spaces 2
./file with spaces

Исходная версия Eddy_Em, :

Кстати, а и правда, что скажет твой скрипт на такое:

ls
.  ..  file with spaces  file with spaces 2  file with spaces 3  file with spaces and \'apostrophes\'  file with spaces and "quotations"

Простой find на апострофы матюкается:

find . -maxdepth 1 -name "*file*" |while read F; do ls "$F"; done
ls: невозможно получить доступ к ./file with spaces and 'apostrophes': Нет такого файла или каталога
./file with spaces and "quotations"
./file with spaces 3
./file with spaces 2
./file with spaces