home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TEST(1L) TEST(1L)
-
-
-
- NAME
- test - check file types and compare values
-
- SYNOPSIS
- test [expr]
-
- DESCRIPTION
- This manual page documents the GNU version of test.
-
- test returns a status of 0 (true) or 1 (false) depending on
- the evaluation of the conditional expression _✓e_✓x_✓p_✓r. Expres-
- sions may be unary or binary. Unary expressions are often
- used to examine the status of a file. There are string
- operators and numeric comparison operators as well.
-
- -b _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is block special.
- -c _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is character special.
- -d _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is a directory.
- -e _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists
- -f _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is a regular file.
- -g _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is set-group-id.
- -k _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e has its ``sticky'' bit set.
- -L _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is a symbolic link.
- -p _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is a named pipe.
- -r _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is readable.
- -s _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and has a size greater than zero.
- -S _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is a socket.
- -t [_✓f_✓d]
- True if _✓f_✓d is opened on a terminal. If _✓f_✓d is omitted,
- it defaults to 1 (standard output).
- -u _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and its set-user-id bit is set.
- -w _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is writable.
- -x _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is executable.
- -O _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e exists and is owned by the effective user
- id.
- -G _✓f_✓i_✓l_✓e
-
-
-
- Page 1
-
-
-
-
-
-
- TEST(1L) TEST(1L)
-
-
-
- True if _✓f_✓i_✓l_✓e exists and is owned by the effective group
- id.
- _✓f_✓i_✓l_✓e_✓1 -nt _✓f_✓i_✓l_✓e_✓2
- True if _✓f_✓i_✓l_✓e_✓1 is newer (according to modification date)
- than _✓f_✓i_✓l_✓e_✓2.
- _✓f_✓i_✓l_✓e_✓1 -ot _✓f_✓i_✓l_✓e_✓2
- True if _✓f_✓i_✓l_✓e_✓1 is older than file2.
- _✓f_✓i_✓l_✓e_✓1 -ef _✓f_✓i_✓l_✓e
- True if _✓f_✓i_✓l_✓e_✓1 and _✓f_✓i_✓l_✓e_✓2 have the same device and inode
- numbers.
- -z _✓s_✓t_✓r_✓i_✓n_✓g
- True if the length of _✓s_✓t_✓r_✓i_✓n_✓g is zero.
- -n _✓s_✓t_✓r_✓i_✓n_✓g
- _✓s_✓t_✓r_✓i_✓n_✓g
- True if the length of _✓s_✓t_✓r_✓i_✓n_✓g is non-zero.
- _✓s_✓t_✓r_✓i_✓n_✓g_✓1 = _✓s_✓t_✓r_✓i_✓n_✓g_✓2
- True if the strings are equal.
- _✓s_✓t_✓r_✓i_✓n_✓g_✓1 != _✓s_✓t_✓r_✓i_✓n_✓g_✓2
- True if the strings are not equal.
- ! _✓e_✓x_✓p_✓r
- True if _✓e_✓x_✓p_✓r is false.
- _✓e_✓x_✓p_✓r_✓1 -a _✓e_✓x_✓p_✓r_✓2
- True if both _✓e_✓x_✓p_✓r_✓1 and _✓e_✓x_✓p_✓r_✓2 are true.
- _✓e_✓x_✓p_✓r_✓1 -o _✓e_✓x_✓p_✓r_✓2
- True if either _✓e_✓x_✓p_✓r_✓1 or _✓e_✓x_✓p_✓r_✓2 is true.
- _✓a_✓r_✓g_✓1 OP _✓a_✓r_✓g_✓2
- OP is one of -eq, -ne, -lt, -le, -gt, or -ge. These
- arithmetic binary operators return true if _✓a_✓r_✓g_✓1 is
- equal, not-equal, less-than, less-than-or-equal,
- greater-than, or greater-than-or-equal than _✓a_✓r_✓g_✓2,
- respectively. _✓a_✓r_✓g_✓1 and _✓a_✓r_✓g_✓2 may be positive integers,
- negative integers, or the special expression -l _✓s_✓t_✓r_✓i_✓n_✓g,
- which evaluates to the length of _✓s_✓t_✓r_✓i_✓n_✓g.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2
-
-
-
-