summaryrefslogtreecommitdiff
path: root/static/v10/man1/if.1
blob: 917ec74018150a248969bff8078759c6fa42838d (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
68
69
70
71
72
73
74
75
76
.pa 1
.he 'IF (I)'3/15/72'IF (I)'
.ti 0
NAME		if --  conditional command
.sp
.ti 0
SYNOPSIS	if__ expr command [ arg918 ... ]
.sp
.ti 0
DESCRIPTION	if__
evaluates the expression expr____, and if its value is true____,
executes the given command_______ with the given arguments.

The following primitives are used to construct
the expr____:

.in +9
.ti -4
-r__ file
.br
true if the file exists and is readable.

.ti -4
-w__ file
.br
true if the file exists and is writable

.ti -4
s1 =_ s2
.br
true if the strings s1__ and s2__ are equal.

.ti -4
s1 !=__ s2
.br
true if the strings s1__ and s2__ are not equal.

.in -9
These primaries may be combined with the
following operators:

.in +5
!_
.ti +4
unary negation operator

-a__
.ti +4
binary and___ operator

-o__
.ti +4
binary or__ operator

(_ expr )_
.ti +4
parentheses for grouping.

.in -5
-a__ has higher precedence than -o__.
Notice that all the operators and flags are separate
arguments to if__ and hence must be surrounded by spaces.
.sp
.ti 0
FILES		--
.sp
.ti 0
SEE ALSO	sh(I)
.sp
.ti 0
DIAGNOSTICS	"if error",
if the expression has the wrong syntax;
"command not found."
.sp
.ti 0
BUGS		--