test (arguments) Flashcards

1
Q

True if FILE exists.

A

[ -a FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True if FILE exists and is a block-special file.

A

[ -b FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True if FILE exists and is a character-special file.

A

[ -c FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True if FILE exists and is a directory.

A

[ -d FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True if FILE exists.

A

[ -e FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True if FILE exists and is a regular file.

A

[ -f FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True if FILE exists and its SGID bit is set.

A

[ -g FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True if FILE exists and is a symbolic link.

A

[ -h FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True if FILE exists and its sticky bit is set.

A

[ -k FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True if FILE exists and is a named pipe (FIFO).

A

[ -p FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True if FILE exists and is readable.

A

[ -r FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True if FILE exists and has a size greater than zero.

A

[ -s FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True if file descriptor FD is open and refers to a terminal.

A

[ -t FD ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True if FILE exists and its SUID (set user ID) bit is set.

A

[ -u FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

True if FILE exists and is writable.

A

[ -w FILE ]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True if FILE exists and is executable.

A

[ -x FILE ]

17
Q

True if FILE exists and is owned by the effective user ID.

A

[ -O FILE ]

18
Q

True if FILE exists and is owned by the effective group ID.

A

[ -G FILE ]

19
Q

True if FILE exists and is a symbolic link.

A

[ -L FILE ]

20
Q

True if FILE exists and has been modified since it was last read.

A

[ -N FILE ]

21
Q

True if FILE exists and is a socket.

A

[ -S FILE ]

22
Q

True if FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not.

A

[ FILE1 -nt FILE2 ]

23
Q

True if FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not.

A

[ FILE1 -ot FILE2 ]

24
Q

True if FILE1 and FILE2 refer to the same device and inode numbers.

A

[ FILE1 -ef FILE2 ]

25
True if shell option "OPTIONNAME" is enabled.
[ -o OPTIONNAME ]
26
True if the length of "STRING" is zero.
[ -z STRING ]
27
True if the length of "STRING" is non-zero.
[ -n STRING ] or [ STRING ]
28
True if the strings are equal. "=" may be used instead of "==" for strict POSIX compliance.
[ STRING1 == STRING2 ]
29
True if the strings are not equal.
[ STRING1 != STRING2 ]
30
True if "STRING1" sorts before "STRING2" lexicographically in the current locale.
[ STRING1 < STRING2 ]
31
True if "STRING1" sorts after "STRING2" lexicographically in the current locale.
[ STRING1 > STRING2 ]
32
True if EXPR is false.
[ ! EXPR ]
33
Returns the value of EXPR. This may be used to override the normal precedence of operators.
[ ( EXPR ) ]
34
True if both EXPR1 and EXPR2 are true.
[ EXPR1 -a EXPR2 ]
35
True if either EXPR1 or EXPR2 is true.
[ EXPR1 -o EXPR2 ]