Что означает -x
здесь:
if [ -x /etc/rc.local ] then
Как я могу найти эту страницу руководства для if
?
От эти man bash
страницы (особенно раздел CONDITIONAL EXPRESSIONS):
-a file
True if file exists.
-b file
True if file exists and is a block special file.
-c file
True if file exists and is a character special file.
-d file
True if file exists and is a directory.
-e file
True if file exists.
-f file
True if file exists and is a regular file.
-g file
True if file exists and is set-group-id.
-h file
True if file exists and is a symbolic link.
-k file
True if file exists and its ``sticky'' bit is set.
-p file
True if file exists and is a named pipe (FIFO).
-r file
True if file exists and is readable.
-s file
True if file exists and has a size greater than zero.
-t fd True if file descriptor fd is open and refers to a terminal.
-u file
True if file exists and its set-user-id bit is set.
-w file
True if file exists and is writable.
-x file
True if file exists and is executable.
[...]
if
самостоятельно ключевое слово оболочки, таким образом, можно найти информацию об этом с help if
. if
самостоятельно только ответвления на основе того, возвращается ли следующая команда верный (0) или ложь (не нуль). Что Вы действительно хотите, хотя, man [
или man test
, где [
псевдоним для test
. Тот оператор на самом деле выполняется test -x /etc/rc.local
, который тестирует, чтобы видеть, существует ли тот файл и является исполняемым файлом (или имеет поисковое разрешение).
От info test
:
`-x FILE'
True if FILE exists and execute permission is granted (or search permission, if it is a directory).
Выполняются, разрешение необходимо на каталоге, чтобы быть в состоянии к CD в него (то есть, сделать некоторый каталог Вашим текущим рабочим каталогом).
Выполняются, необходим на каталоге для доступа к "inode" информации файлов в. Вам нужно это для поиска каталога для чтения inodes файлов в. Поэтому выполнить разрешение на каталоге часто называют поисковым разрешением вместо этого.