Остання активність 1745376842

Условные выражения для файлов в bash

LittleGreenCat's Avatar LittleGreenCat ревизій цього gist 1745376842. До ревизії

1 file changed, 41 insertions

conditional.sh(файл створено)

@@ -0,0 +1,41 @@
1 + ## True if file exists.
2 + [[ -a ${file} ]]
3 +
4 + ## True if file exists and is a block special file.
5 + [[ -b ${file} ]]
6 +
7 + ## True if file exists and is a character special file.
8 + [[ -c ${file} ]]
9 +
10 + ## True if file exists and is a directory.
11 + [[ -d ${file} ]]
12 +
13 + ## True if file exists.
14 + [[ -e ${file} ]]
15 +
16 + ## True if file exists and is a regular file.
17 + [[ -f ${file} ]]
18 +
19 + ## True if file exists and is a symbolic link.
20 + [[ -h ${file} ]]
21 +
22 + ## True if file exists and is readable.
23 + [[ -r ${file} ]]
24 +
25 + ## True if file exists and has a size greater than zero.
26 + [[ -s ${file} ]]
27 +
28 + ## True if file exists and is writable.
29 + [[ -w ${file} ]]
30 +
31 + ## True if file exists and is executable.
32 + [[ -x ${file} ]]
33 +
34 + ## True if file exists and is a symbolic link.
35 + [[ -L ${file} ]]
36 +
37 + # PS. в линукс все есть файл или поток :)
38 +
39 + # PPS. И переменные окружения.
40 +
41 + # Опубликовано в https://t.me/gitgate
Новіше Пізніше