Annotation of coherent/a/usr/man/COHERENT/test, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: test                         Command                         test
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Evaluate conditional expression
                      9: 
                     10: tteesstt _e_x_p_r_e_s_s_i_o_n ...
                     11: 
                     12: tteesstt   evaluates  an   _e_x_p_r_e_s_s_i_o_n,  which   consists   of  string
                     13: comparisons, numerical comparisons, and tests of file attributes.
                     14: For example, a tteesstt command  might be used within a shell command
                     15: file to test whether a  certain file exists and is readable.  The
                     16: logical result  (true or false) of the  _e_x_p_r_e_s_s_i_o_n is returned by
                     17: the command, for use by a shell construct such as iiff.
                     18: 
                     19: _e_x_p_r_e_s_s_i_o_n is constructed  from the following elements, which are
                     20: true if the given condition holds and false if not:
                     21: 
                     22: _e_x_p_1 -aa _e_x_p_2
                     23:           Both expressions _e_x_p_1 and _e_x_p_2 are true.
                     24: 
                     25: -bb _f_i_l_e   _f_i_l_e is a block-special device.  kksshh only.
                     26: 
                     27: -cc _f_i_l_e   _f_i_l_e is a character-special file.  kksshh only.
                     28: 
                     29: -dd _f_i_l_e   _f_i_l_e exists and is a directory.
                     30: 
                     31: _f_i_l_e_1 -eeff _f_i_l_e_2
                     32:           _f_i_l_e_1 is the same file as _f_i_l_e_2. kksshh only.
                     33: 
                     34: _n_1 -eeqq _n_2 Numbers _n_1 and _n_2 are equal.
                     35: 
                     36: -ff _f_i_l_e   _f_i_l_e exists and is not a directory.
                     37: 
                     38: -gg _f_i_l_e   File mode has sseettggiidd bit.  kksshh only.
                     39: 
                     40: _n_1 -ggee _n_2 Number _n_1 is greater than or equal to _n_2.
                     41: 
                     42: _n_1 -ggtt _n_2 Number _n_1 is greater than _n_2.
                     43: 
                     44: -kk _f_i_l_e   File mode has sticky bit.  kksshh only.
                     45: 
                     46: -LL _f_i_l_e   File is a symbolic link.  kksshh only.
                     47: 
                     48: _n_1 -llee _n_2 Number _n_1 is less than or equal to _n_2.
                     49: 
                     50: _n_1 -lltt _n_2 Number _n_1 is less than _n_2.
                     51: 
                     52: -nn _s_t_r_i_n_g _s_t_r_i_n_g has nonzero length.
                     53: 
                     54: _n_1 -nnee _n_2 Numbers _n_1 and _n_2 are not equal.
                     55: 
                     56: _f_i_l_e_1 -nntt _f_i_l_e_2
                     57:           _f_i_l_e_1 is newer than kksshh only.
                     58: 
                     59: _e_x_p_1 -oo _e_x_p_2
                     60:           Either expression _e_x_p_1 or _e_x_p_2 is true.  -aa has greater
                     61:           precedence than -oo.
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: test                         Command                         test
                     70: 
                     71: 
                     72: 
                     73: 
                     74: _f_i_l_e_1 -oott _f_i_l_e_2
                     75:           _f_i_l_e_1 is older than _f_i_l_e_2. kksshh only.
                     76: 
                     77: -pp _f_i_l_e   _f_i_l_e is a named pipe.  kksshh only.
                     78: 
                     79: -rr _f_i_l_e   _f_i_l_e exists and is readable.
                     80: 
                     81: -ss _f_i_l_e   _f_i_l_e exists and has nonzero size.
                     82: 
                     83: -tt [_f_d]   _f_d is  the file  descriptor number  of a file  which is
                     84:           open and a terminal.  If no _f_d is given, it defaults to
                     85:           the standard output (file descriptor 1).
                     86: 
                     87: -uu _f_i_l_e   File mode has sseettuuiidd set.  kksshh only.
                     88: 
                     89: -ww _f_i_l_e   _f_i_l_e exists and is writable.
                     90: 
                     91: -xx _f_i_l_e   _f_i_l_e exists and executable.  kksshh only.
                     92: 
                     93: -zz _s_t_r_i_n_g _s_t_r_i_n_g has zero length (is a null string).
                     94: 
                     95: _s_t_r_i_n_g    _s_t_r_i_n_g has nonzero length.
                     96: 
                     97: _s_t_r_i_n_g_1 = _s_t_r_i_n_g_2
                     98:           _s_t_r_i_n_g_1 is equal to _s_t_r_i_n_g_2.
                     99: 
                    100: ! _e_x_p     Negates the logical value of expression _e_x_p.
                    101: 
                    102: _s_t_r_i_n_g_1 != _s_t_r_i_n_g_2
                    103:           _s_t_r_i_n_g_1 is not equal to _s_t_r_i_n_g_2.
                    104: 
                    105: (_e_x_p)     Parentheses allow expression grouping.
                    106: 
                    107: ***** Example *****
                    108: 
                    109: The following example  uses the tteesstt command to determine whether
                    110: a file is writable.
                    111: 
                    112: 
                    113: if test ! -w /dev/lp
                    114: then
                    115:         echo The line printer is inaccessible.
                    116: fi
                    117: 
                    118: 
                    119: Under COHERENT, the command `['  is linked to tteesstt. If invoked as
                    120: `[', tteesstt  checks that its last argument is  `]'.  This allows an
                    121: alternative syntax: simply enclose _e_x_p_r_e_s_s_i_o_n in square brackets.
                    122: For example, the above example can be written as follows:
                    123: 
                    124: 
                    125: 
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 
                    133: 
                    134: 
                    135: test                         Command                         test
                    136: 
                    137: 
                    138: 
                    139: if [ ! -w /dev/lp ]
                    140: then
                    141:         echo The line printer is inaccessible.
                    142: fi
                    143: 
                    144: 
                    145: For a more extended example of the square-bracket syntax, see sshh.
                    146: 
                    147: ***** See Also *****
                    148: 
                    149: ccoommmmaannddss, eexxpprr, ffiinndd, iiff, kksshh, sshh, wwhhiillee
                    150: 
                    151: ***** Notes *****
                    152: 
                    153: The Korn shell's version of  this command is based on the public-
                    154: domain version written by Erik Baalbergen and Arnold Robbins.
                    155: 
                    156: 
                    157: 
                    158: 
                    159: 
                    160: 
                    161: 
                    162: 
                    163: 
                    164: 
                    165: 
                    166: 
                    167: 
                    168: 
                    169: 
                    170: 
                    171: 
                    172: 
                    173: 
                    174: 
                    175: 
                    176: 
                    177: 
                    178: 
                    179: 
                    180: 
                    181: 
                    182: 
                    183: 
                    184: 
                    185: 
                    186: 
                    187: 
                    188: 
                    189: 
                    190: 
                    191: 
                    192: 
                    193: 
                    194: 
                    195: 
                    196: COHERENT Lexicon                                           Page 3
                    197: 
                    198: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.