conditional.sh
· 905 B · Bash
Brut
## True if file exists.
[[ -a ${file} ]]
## True if file exists and is a block special file.
[[ -b ${file} ]]
## True if file exists and is a character special file.
[[ -c ${file} ]]
## True if file exists and is a directory.
[[ -d ${file} ]]
## True if file exists.
[[ -e ${file} ]]
## True if file exists and is a regular file.
[[ -f ${file} ]]
## True if file exists and is a symbolic link.
[[ -h ${file} ]]
## True if file exists and is readable.
[[ -r ${file} ]]
## True if file exists and has a size greater than zero.
[[ -s ${file} ]]
## True if file exists and is writable.
[[ -w ${file} ]]
## True if file exists and is executable.
[[ -x ${file} ]]
## True if file exists and is a symbolic link.
[[ -L ${file} ]]
# PS. в линукс все есть файл или поток :)
# PPS. И переменные окружения.
# Опубликовано в https://t.me/gitgate
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 |