Son aktivite 1745376938

Условные выражения для строковых переменных в bash

LittleGreenCat's Avatar LittleGreenCat bu gisti düzenledi 1745376938. Düzenlemeye git

1 file changed, 22 insertions

bash.sh(dosya oluşturuldu)

@@ -0,0 +1,22 @@
1 + # True if the shell variable varname is set (has been assigned a value).
2 + [[ -v ${varname} ]]
3 +
4 + # True if the length of the string is zero.
5 + [[ -z ${string} ]]
6 +
7 + # True if the length of the string is non-zero.
8 + [[ -n ${string} ]]
9 +
10 + # True if the strings are equal. = should be used with the test command for POSIX conformance. When used with the [[ command, this performs pattern matching as described above (Compound Commands)
11 + [[ ${string1} == ${string2} ]]
12 +
13 + # True if the strings are not equal.
14 + [[ ${string1} != ${string2} ]]
15 +
16 + # True if string1 sorts before string2 lexicographically.
17 + [[ ${string1} < ${string2} ]]
18 +
19 + # True if string1 sorts after string2 lexicographically.
20 + [[ ${string1} > ${string2} ]]
21 +
22 + Опубликовано в https://t.me/gitgate
Daha yeni Daha eski