5,321
edits
(→Trap) |
|||
Line 30: | Line 30: | ||
[https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html bash if statements] | [https://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html bash if statements] | ||
;Some common expressions: | |||
<syntaxhighlight lang="bash"> | |||
# File exists and is a regular file. | |||
[ -f $FILE ] | |||
# File is non-zero size | |||
[ -s $FILE ] | |||
# String has length zero | |||
[ -z $STR ] | |||
# String has length non-zero | |||
[ -n $STR ] | |||
</syntaxhighlight> | |||
===Comparisons=== | ===Comparisons=== |