Вы находитесь на странице: 1из 1

if options -- http://www.dartmouth.edu/~rc/classes/ksh/cond-tests.

html
#top
--------------------------------------------------------------------------------
-------------------------
Conditional tests for [...] and [[...]] commands
Most of the useful flow-control operators involve making some conditional test a
nd branching on the result (true/false). The test can be either the test command
, or its alias, [, or the ksh/bash built-in [[ ... ]] command, which has slightl
y different options, or it can be any command which returns a suitable exit stat
us. Zero is taken to be "True", while any non-zero value is "False". Note that t
his is backwards from the C language convention.
File tests
-e file True if file exists (can be of any type).
-f file True if file exists and is an ordinary file.
-d file True if file exists and is a directory.
-r file True if file exists and is readable
Similarly,
-w = writable,
-x = executable,
-L = is a symlink.
-s file True if file exists and has size greater than ze
ro
-t filedescriptor True if the open filedescriptor is associated wi
th a terminal device. E.g. this is used to determine if standard output has been
redirected to a file.
Character string tests
-n "string" true if string has non-zero length
-z "string" true if string has zero length
$variable = text True if $variable matches text.
$variable < text True if $variable comes before (lexically) text
Similarly, > = comes after

Вам также может понравиться