Учитывая следующий каталог:
[~/test]find .
.
./something_else.txt
./univision.rbw
./something_else.rb
./testtest
./testtest/weewee.rb
./testtest/weewee.txt
./univision.rb
Выполнение следующей команды sed генерирует много ошибок mv
:
[~/test]for i in $( find . ); do mv $i `echo $i | sed s/test/this_is_not_a_test/g`; done;
mv: ‘.’ and ‘./.’ are the same file
mv: ‘./something_else.txt’ and ‘./something_else.txt’ are the same file
mv: ‘./univision.rbw’ and ‘./univision.rbw’ are the same file
mv: ‘./something_else.rb’ and ‘./something_else.rb’ are the same file
mv: cannot stat ‘./testtest/weewee.rb’: No such file or directory
mv: cannot stat ‘./testtest/weewee.txt’: No such file or directory
mv: ‘./univision.rb’ and ‘./univision.rb’ are the same file
но это также «работает»
[~/test]find .
.
./something_else.txt
./univision.rbw
./something_else.rb
./this_is_not_a_testthis_is_not_a_test
./this_is_not_a_testthis_is_not_a_test/weewee.rb
./this_is_not_a_testthis_is_not_a_test/weewee.txt
./univision.rb
Что мне здесь не хватает?