|
|
1.1 ! root 1: .TH TEST 1 "18 January 1983" ! 2: .SH NAME ! 3: test \- condition command ! 4: .SH SYNOPSIS ! 5: .B test ! 6: expr ! 7: .SH DESCRIPTION ! 8: .I test ! 9: evaluates the expression ! 10: .IR expr , ! 11: and if its value is true then returns zero exit status; otherwise, a ! 12: non zero exit status is returned. ! 13: .I test ! 14: returns a non zero exit if there are no arguments. ! 15: .PP ! 16: The following primitives are used to construct ! 17: .IR expr . ! 18: .TP 9n ! 19: .BR \-r " file" ! 20: true if the file exists and is readable. ! 21: .TP ! 22: .BR \-w " file" ! 23: true if the file exists and is writable. ! 24: .TP ! 25: .BR \-f " file" ! 26: true if the file exists and is not a directory. ! 27: .TP ! 28: .BR \-d " file" ! 29: true if the file exists exists and is a directory. ! 30: .TP ! 31: .BR \-s " file" ! 32: true if the file exists and has a size greater than zero. ! 33: .TP ! 34: .BR \-t " [ fildes ]" ! 35: true if the open file whose file descriptor number is ! 36: .I fildes ! 37: (1 by default) ! 38: is associated with a terminal device. ! 39: .TP ! 40: .BR \-z " s1" ! 41: true if the length of string ! 42: .I s1 ! 43: is zero. ! 44: .TP ! 45: .BR \-n " s1" ! 46: true if the length of the string ! 47: .I s1 ! 48: is nonzero. ! 49: .TP ! 50: .RB s1 " = " s2 ! 51: true ! 52: if the strings ! 53: .I s1 ! 54: and ! 55: .I s2 ! 56: are equal. ! 57: .TP ! 58: .RB s1 " != " s2 ! 59: true ! 60: if the strings ! 61: .I s1 ! 62: and ! 63: .I s2 ! 64: are not equal. ! 65: .TP ! 66: s1 ! 67: true if ! 68: .I s1 ! 69: is not the null string. ! 70: .TP ! 71: .RB n1 " \-eq " n2 ! 72: true if the integers ! 73: .I n1 ! 74: and ! 75: .I n2 ! 76: are algebraically equal. ! 77: Any of the comparisons ! 78: .BR \-ne , ! 79: .BR \-gt , ! 80: .BR \-ge , ! 81: .BR \-lt , ! 82: or ! 83: .BR \-le ! 84: may be used in place of ! 85: .BR \-eq . ! 86: .PP ! 87: These primaries may be combined with the ! 88: following operators: ! 89: .TP ! 90: .B ! ! 91: unary negation operator ! 92: .TP ! 93: .B \-a ! 94: binary ! 95: .I and ! 96: operator ! 97: .TP ! 98: .B \-o ! 99: binary ! 100: .I or ! 101: operator ! 102: .TP ! 103: .BR "( " "expr" " )" ! 104: parentheses for grouping. ! 105: .PP ! 106: .B \-a ! 107: has higher precedence than ! 108: .B \-o. ! 109: Notice that all the operators and flags are separate ! 110: arguments to ! 111: .IR test . ! 112: Notice also that parentheses are meaningful ! 113: to the Shell and must be escaped. ! 114: .SH "SEE ALSO" ! 115: sh(1), find(1)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.