2015-01-30 21:52:01 +00:00
|
|
|
.Dd January 30, 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
|
|
|
|
.Nd check file types and compare values
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Ar EXPRESSION
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
Exit with the status determined by
|
|
|
|
.Ar EXPRESSION .
|
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It ! Ar EXPRESSION
|
|
|
|
invert EXPRESSION
|
|
|
|
.It Fl b Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is block special
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl c Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is character special
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl d Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is a directory
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl e Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl f Ar FILE
|
|
|
|
FILE exists and is a regular file
|
|
|
|
.It Fl g Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is set-group-ID
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl h Ar FILE
|
|
|
|
FILE exists and is a symbolic link (same as
|
|
|
|
.Fl L )
|
|
|
|
.It Fl k Ar FILE
|
2013-11-11 11:37:07 +00:00
|
|
|
FILE exists and its sticky bit is set
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl L Ar FILE
|
|
|
|
FILE exists and is a symbolic link (same as
|
|
|
|
.Fl h )
|
|
|
|
.It Fl n Ar STRING
|
2013-07-23 12:03:22 +00:00
|
|
|
the length of STRING is nonzero
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl p Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is a named pipe
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl r Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and read permission is granted
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl S Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and is a socket
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl s Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and has a size greater than zero
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl t Ar FD
|
2013-07-23 12:03:22 +00:00
|
|
|
file descriptor FD is opened on a terminal
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl u Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
exists and its set-user-ID bit is set
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl w Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and write permission is granted
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl x Ar FILE
|
2013-07-23 12:03:22 +00:00
|
|
|
FILE exists and execute (or search) permission is granted
|
2015-01-30 21:52:01 +00:00
|
|
|
.It Fl z Ar STRING
|
2013-07-23 12:03:22 +00:00
|
|
|
the length of STRING is zero
|
2015-01-30 21:52:01 +00:00
|
|
|
.It s1 = s2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the strings s1 and s2 are identical
|
2015-01-30 21:52:01 +00:00
|
|
|
.It s1 != s2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the strings s1 and s2 are not identical
|
2015-01-30 21:52:01 +00:00
|
|
|
.It s1
|
2013-11-11 11:46:53 +00:00
|
|
|
True if s1 is not the null string
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -eq n2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the integers n1 and n2 are equal
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -ne n2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the integers n1 and n2 are not equal
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -gt n2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the integer n1 is greater than the integer n2
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -ge n2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the integer n1 is great than or equal to the integer n2
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -lt n2
|
2013-11-11 11:46:53 +00:00
|
|
|
True if the integer n1 is less than the integer n2
|
2015-01-30 21:52:01 +00:00
|
|
|
.It n1 -le n2
|
|
|
|
True if the integer n1 is less than or equal to the integer n2
|
|
|
|
.El
|