Unix and Linux Discussions Tagged with exists |
|
Thread / Thread Starter |
Last Post |
Replies |
Views |
Forum |
|
|
|
3 |
6,260 |
UNIX for Beginners Questions & Answers |
|
|
|
6 |
8,510 |
Shell Programming and Scripting |
|
|
|
5 |
7,908 |
UNIX for Beginners Questions & Answers |
|
|
|
10 |
9,209 |
UNIX for Beginners Questions & Answers |
|
|
|
3 |
3,935 |
UNIX for Beginners Questions & Answers |
|
|
|
1 |
4,923 |
Shell Programming and Scripting |
|
|
|
9 |
4,011 |
Shell Programming and Scripting |
|
|
|
3 |
5,405 |
Shell Programming and Scripting |
|
|
|
6 |
23,589 |
HP-UX |
|
|
|
1 |
9,715 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
2,782 |
UNIX for Advanced & Expert Users |
|
|
|
4 |
6,877 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
12,018 |
Shell Programming and Scripting |
|
|
|
3 |
3,406 |
UNIX for Dummies Questions & Answers |
|
|
|
27 |
10,962 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
19,133 |
Programming |
|
|
|
20 |
34,669 |
Cybersecurity |
|
|
|
1 |
2,801 |
UNIX for Dummies Questions & Answers |
|
|
|
4 |
5,936 |
UNIX for Advanced & Expert Users |
|
|
|
3 |
3,820 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
5,440 |
Programming |
|
|
|
1 |
2,934 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,098 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
18,531 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
25,431 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
6,702 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
36,943 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
15,212 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
3,583 |
UNIX for Dummies Questions & Answers |
|
|
|
1 |
2,928 |
UNIX for Dummies Questions & Answers |
|
|
|
5 |
12,072 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
4,444 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
3,363 |
UNIX for Dummies Questions & Answers |
|
|
|
3 |
2,967 |
UNIX for Dummies Questions & Answers |
|
|
|
2 |
19,118 |
UNIX for Dummies Questions & Answers |
test(1sh5) test(1sh5)
Name
test - condition evaluation command
Syntax
test expr
[ expr ]
Description
The command evaluates the expression expr. If the value of expr is true, the command returns a zero exit status; otherwise, it returns a
nonzero exit status. The command also returns a nonzero exit status if no arguments are specified. The following primitives are used to
construct expr:
-r file True if file exists and is readable.
-w file True if file exists and is writable.
-x file True if file exists and is executable.
-f file True if file exists and is a regular file.
-d file True if file exists and is a directory.
-c file True if file exists and is a character special file.
-b file True if file exists and is a block special file.
-p file True if file exists and is a named pipe (fifo).
-u file True if file exists and its set-user-ID bit is set.
-g file True if file exists and its set-group-ID bit is set.
-k file True if file exists and its sticky bit is set.
-s file True if file exists and has a size greater than zero.
-t [ fildes ] True if the open file whose file descriptor number is fildes (1 by default) is associated with a terminal device.
-z s1 True if the length of string s1 is zero.
-n s1 True if the length of the string s1 is non-zero.
s1 = s2 True if strings s1 and s2 are identical.
s1 != s2 True if strings s1 and s2 are not identical.
s1 True if s1 is not the null string.
n1 -eq n2 True if the integers n1 and n2 are algebraically equal. Any of the comparisons -ne, -gt, -ge, -lt, and -le may be used in
place of -eq.
These primitives can be combined with the following operators:
! unary negation operator.
-a binary and operator.
-o binary or operator (-a has higher precedence than -o).
( expr ) parentheses for grouping.
Note that all the operators and flags are separate arguments to the command. Note also that parentheses are meaningful to the Shell and
must be escaped. In the form of the command that uses square brackets ([]), instead of the word test, the brackets must be delimited by
blanks.
See Also
find(1), sh5(1), test(1)
test(1sh5)