Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
test(1)			    General Commands Manual		       test(1)

NAME
       test - condition	evaluation command

SYNOPSIS
       expr

DESCRIPTION
       The  command  evaluates	the expression expr and, if its	value is True,
       returns a zero (true) exit status; otherwise, a	nonzero	 (false)  exit
       status is returned.  also returns a nonzero exit	status if there	are no
       arguments.  The following primitives are	used to	construct expr:

	      True if	     file exists and is	readable.

	      True if	     file exists and is	writable.

	      True if	     file exists and is	executable.

	      True if	     file exists and is	a regular file.

	      True if	     file exists and is	a directory.

	      True if	     file exists and is	a character special file.

	      True if	     file exists and is	a block	special	file.

	      True if	     file exists and is	a named	pipe (fifo).

	      True if	     file exists and its set-user-ID bit is set.

	      True if	     file exists and its set-group-ID bit is set.

	      True if	     file exists and its sticky	bit is set.

	      True if	     file exists and has a size	greater	than zero.

	      True if	     file exists and is	a symbolic link.

	      True if the open file whose file descriptor number is
			     fildes (1 by default) is associated with a	termi-
			     nal device.

	      True if the length of string
			     s1	is zero.

	      True if the length of the	string
			     s1	is non-zero.

	      True if strings
			     s1	and s2 are identical.

	      True if strings
			     s1	and s2 are not identical.

	      s1	     True if s1	is not the null	string.

	      True if the integers
			     n1	 and  n2  are algebraically equal.  Any	of the
			     comparisons and can be used in place of

       These primaries can be combined with the	following operators:

	      Unary negation operator.

	      Binary AND operator.

	      Binary OR	operator
			     has higher	precedence than

	      Parentheses for grouping.

       Note that all the operators and flags are separate  arguments  to  Note
       also  that  parentheses are significant to the shell and	therefore must
       be escaped.  All	file test operators return success if the argument  is
       a symbolic link that points to a	file of	the file type being tested.

       is interpreted directly by the shell, and therefore does	not exist as a
       separate	executable program.

EXTERNAL INFLUENCES
   International Code Set Support
       Single byte and multibyte character code	sets are supported.

EXAMPLES
       Exit if there are not two or three arguments:

       Create a	new file containing the	text string if the file	does  not  al-
       ready exist:

       Wait for	myfile to become non-readable:

WARNINGS
       When  the  form of this command is used,	the matching must be the final
       argument, and both must be separate arguments from the  arguments  they
       enclose (white space delimiters required.

       Parentheses  and	other special shell metacharacters intended to be han-
       dled by test must be escaped or quoted when invoking from a shell.

       Avoid such problems when	comparing strings by inserting a  non-operator
       character at the	beginning of both operands:

       This approach does not work with	numeric	comparisons or the unary oper-
       ators because it	would affect the operand being checked.

AUTHOR
       was developed by	the University of California, Berkeley and HP.

SEE ALSO
       find(1),	sh-posix(1), sh(1).

STANDARDS CONFORMANCE
								       test(1)

NAME | SYNOPSIS | DESCRIPTION | EXTERNAL INFLUENCES | EXAMPLES | WARNINGS | AUTHOR | SEE ALSO | STANDARDS CONFORMANCE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=test&sektion=1&manpath=HP-UX+11.22>

home | help