2015-02-09 21:21:23 +00:00
|
|
|
.Dd February 9, 2015
|
2015-01-31 13:20:02 +00:00
|
|
|
.Dt TEST 1
|
2015-01-31 19:37:03 +00:00
|
|
|
.Os sbase
|
2015-01-30 21:52:01 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm test
|
2015-02-09 21:21:23 +00:00
|
|
|
.Nd evaluate expression
|
2015-01-30 21:52:01 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2015-02-09 21:21:23 +00:00
|
|
|
.Ar expression
|
2015-01-30 21:52:01 +00:00
|
|
|
.Sh DESCRIPTION
|
2015-02-09 21:21:23 +00:00
|
|
|
.Nm
|
|
|
|
returns the status of the
|
|
|
|
.Ar expression .
|
2015-01-30 21:52:01 +00:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
2015-02-09 21:21:23 +00:00
|
|
|
.It Sy ! Ar expression
|
|
|
|
.Sy invert
|
|
|
|
.Ar expression .
|
|
|
|
.It Sy -(e | s) Ar file
|
|
|
|
.Ar file
|
|
|
|
.Sy exists
|
|
|
|
and has
|
|
|
|
.Sy arbitrary size | size greater than zero .
|
|
|
|
.It Sy -(f | d | p | hL | S | b | c) Ar file
|
|
|
|
.Ar file
|
|
|
|
.Sy exists
|
|
|
|
and is
|
|
|
|
.Sy regular file | directory | named pipe | symbolic link | socket | block special | character special .
|
|
|
|
.It Sy -(k | g | u | r | w | x) Ar file
|
|
|
|
.Ar file
|
|
|
|
.Sy exists
|
|
|
|
and is
|
|
|
|
.Sy sticky(1) | setgid(2) | setuid(4) | readable | writable | executable (or searchable) .
|
|
|
|
.It Fl t Ar fd
|
|
|
|
.Ar fd
|
|
|
|
as a file descriptor is
|
|
|
|
.Sy associated with a terminal .
|
|
|
|
.It Ar string
|
|
|
|
True if
|
|
|
|
.Ar string
|
|
|
|
is
|
|
|
|
.Sy not the null string .
|
|
|
|
.It Sy -(z | n) Ar string
|
|
|
|
True if
|
|
|
|
.Ar string
|
|
|
|
has
|
|
|
|
.Sy zero | non-zero
|
|
|
|
length.
|
|
|
|
.It Ar s1 Sy (= | !=) Ar s2
|
|
|
|
True if strings
|
|
|
|
.Ar s1
|
|
|
|
and
|
|
|
|
.Ar s2
|
|
|
|
are
|
|
|
|
.Sy identical | different .
|
|
|
|
.It Ar n1 Sy -(eq | ne | gt | ge | le | lt) Ar n2
|
|
|
|
True if integers
|
|
|
|
.Ar n1
|
|
|
|
and
|
|
|
|
.Ar n2
|
|
|
|
are
|
|
|
|
.Sy = | != | > | >= | <= | < .
|
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It 0
|
|
|
|
.Ar expression
|
|
|
|
is true.
|
|
|
|
.It 1
|
|
|
|
.Ar expression
|
|
|
|
is false.
|
|
|
|
.It > 1
|
|
|
|
An error occurred.
|
2015-01-30 21:52:01 +00:00
|
|
|
.El
|
2015-02-09 21:21:23 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr expr 1
|
|
|
|
.Sh STANDARDS
|