История изменений
Исправление AITap, (текущая версия) :
Так же пробую выполнить через find
$ man find | grep -m2 -A7 ' -execdir'
-execdir command ;
-execdir command {} +
Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally the directory in which you started find. This a much more secure method for invoking commands, as it avoids race conditions during resolution of the paths to the matched files. As with the -exec action, the `+' form of -execdir will build a command line to process more than one matched file, but any given invocation of command will only list files that exist in the same subdirectory. If you use this option, you must ensure that your $PATH environment variable does not reference `.'; otherwise, an attacker can run any commands they like by leaving an appropriately-named file in a directory in which you will run -execdir. The same applies to having entries in $PATH which are empty or which are not absolute directory names.
CHIPOK, chemtech, for i in ... делит "..." как аргументы командной строки, по символам из $IFS, что означает, что пробелы в именах файлов (и вообще спецсимволы) не выживают. Если нужно написать велосипед, делите либо по \n, либо, лучше, по \0 (только \0 не может встретиться в пути к файлу) при помощи read. Если нужно тупо перебрать все файлы, достаточно for i in *
.
Исправление AITap, :
Так же пробую выполнить через find
$ man find | grep -m2 -A7 ' -execdir'
-execdir command ;
-execdir command {} +
Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally the directory in which you started find. This a much more secure method for invoking commands, as it avoids race conditions during resolution of the paths to the matched files. As with the -exec action, the `+' form of -execdir will build a command line to process more than one matched file, but any given invocation of command will only list files that exist in the same subdirectory. If you use this option, you must ensure that your $PATH environment variable does not reference `.'; otherwise, an attacker can run any commands they like by leaving an appropriately-named file in a directory in which you will run -execdir. The same applies to having entries in $PATH which are empty or which are not absolute directory names.
CHIPOK, chemtech, for i in ... делит "..." как аргументы командной строки, по символам из $IFS, что означает, что пробелы в именах файлов (и вообще спецсимволы) не выживают. Если нужно написать велосипед, делите либо по \n, либо, лучше, по \0 (только \0 не может встретиться в пути к файлу) при помощи read.
Исходная версия AITap, :
Так же пробую выполнить через find
$ man find | grep -m2 -A7 ' -execdir'
-execdir command ;
-execdir command {} +
Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally the directory in which you started find. This a much more secure method for invoking commands, as it avoids race conditions during resolution of the paths to the matched files. As with the -exec action, the `+' form of -execdir will build a command line to process more than one matched file, but any given invocation of command will only list files that exist in the same subdirectory. If you use this option, you must ensure that your $PATH environment variable does not reference `.'; otherwise, an attacker can run any commands they like by leaving an appropriately-named file in a directory in which you will run -execdir. The same applies to having entries in $PATH which are empty or which are not absolute directory names.