blob: 70673032867a7be404074b2352b969daa1acf2a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
glob match
quoted pattern is literal
single = also matches
!= pattern
pattern from variable
quoted variable is literal
bracket pattern
no field splitting
empty string is false
&&
||
!
!!
parentheses
&& binds tighter than ||
< and > compare strings
string order, not numeric
-lt is numeric
operands of -eq are arithmetic
-ge -ne -le -gt
regex
regex is unanchored
quoted regex text is literal
... and matches itself
regex from variable
quoted ( is literal
bad regex status=2
file tests
missing file
-ef
-o option on
-o option off
-o unknown option is false
-v set
-v set to empty
-v unset
lone -f is a string
-f as an operand
no globbing of operands
tilde expansion
command substitution
arithmetic expansion
&& short-circuits expansions: c=0
|| short-circuits expansions: c=0
true=0
false=1
chained with &&
in if
while: n=2
redirection after ]]
< needs no spaces
in a function
false in a function
newline before ]]
newline after &&
errexit: tested
errexit: status=1
from eval
syntax [[: 2
syntax [[ a: 2
syntax [[ ]]: 2
syntax [[ a == ]]: 2
syntax [[ ( a ]]: 2
syntax [[ a b ]]: 2
syntax [[ a && ]]: 2
[[ and ]] are words elsewhere
[status 0]
|