sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

test.1 (1819B)


      1 .Dd 2015-10-08
      2 .Dt TEST 1
      3 .Os sbase
      4 .Sh NAME
      5 .Nm test
      6 .Nd evaluate expression
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Ar expression
     10 .Sh DESCRIPTION
     11 .Nm
     12 returns the status of the
     13 .Ar expression .
     14 .Sh OPTIONS
     15 .Bl -tag -width Ds
     16 .It ! Ar expression
     17 invert
     18 .Ar expression .
     19 .It ( Fl e | Fl s ) Ar file
     20 .Ar file
     21 exists and has (any size
     22 .Op Fl e
     23 | non-zero size
     24 .Op Fl s ) .
     25 .It ( Fl f | Fl d | Fl p | Fl hL | Fl S | Fl b | Fl c ) Ar file
     26 .Ar file
     27 exists and is a
     28 (regular file
     29 .Op Fl f
     30 | directory
     31 .Op Fl d
     32 | named pipe
     33 .Op Fl p
     34 | symbolic link
     35 .Op Fl h | Fl L
     36 | socket
     37 .Op Fl S
     38 | block special
     39 .Op Fl b
     40 | character special
     41 .Op Fl c ) .
     42 .It ( Fl k | Fl g | Fl u | Fl r | Fl w | Fl x ) Ar file
     43 .Ar file
     44 exists and has
     45 .Xr ( sticky 1
     46 .Op Fl k
     47 |
     48 .Xr setgid 2
     49 .Op Fl g
     50 |
     51 .Xr setuid 4
     52 .Op Fl u
     53 |
     54 .Xr read 4
     55 .Op Fl r
     56 |
     57 .Xr write 2
     58 .Op Fl w
     59 |
     60 .Xr execute 1
     61 .Op Fl x )
     62 permissions.
     63 .It Fl t Ar fd
     64 .Ar fd
     65 as a file descriptor is associated with a terminal.
     66 .It Ar string
     67 True if
     68 .Ar string
     69 is not the null string.
     70 .It ( Fl z | Fl n ) Ar string
     71 True if
     72 .Ar string
     73 has (zero
     74 .Op Fl z
     75 | non-zero
     76 .Op Fl n )
     77 length.
     78 .It Ar s1 Sy ( = | != ) Ar s2
     79 True if strings
     80 .Ar s1
     81 and
     82 .Ar s2
     83 are
     84 (identical
     85 .Oo Sy = Oc
     86 | different
     87 .Oo Sy != Oc ) .
     88 .It Ar n1 ( Fl eq | Fl ne | Fl gt | Fl ge | Fl le | Fl lt ) Ar n2
     89 True if integers
     90 .Ar n1
     91 and
     92 .Ar n2
     93 are (=
     94 .Op Fl eq
     95 | !=
     96 .Op Fl ne
     97 | >
     98 .Op Fl gt
     99 | >=
    100 .Op Fl ge
    101 | <=
    102 .Op Fl le
    103 | <
    104 .Op Fl lt ) .
    105 .It Ar f1 ( Fl ef | Fl ot | Fl nt ) Ar f2
    106 True if file
    107 .Ar f1
    108 (refer to the same inode as
    109 .Op Fl ef
    110 | has an older mtime than
    111 .Op Fl ot
    112 | has a newer mtime than
    113 .Op Fl nt )
    114 file
    115 .Ar f2 .
    116 .El
    117 .Sh EXIT STATUS
    118 .Bl -tag -width Ds
    119 .It 0
    120 .Ar expression
    121 is true.
    122 .It 1
    123 .Ar expression
    124 is false.
    125 .It > 1
    126 An error occurred.
    127 .El
    128 .Sh SEE ALSO
    129 .Xr expr 1
    130 .Sh STANDARDS
    131 The
    132 .Nm
    133 utility is compliant with the
    134 .St -p1003.1-2013
    135 specification.