Документ взят из кэша поисковой машины. Адрес оригинального документа : http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.4.1.html
Дата изменения: Fri Jan 17 12:43:19 1997
Дата индексирования: Tue Oct 2 01:14:06 2012
Кодировка:

Поисковые слова: m 17
The if statement

The if statement

The if statement uses the exit status of the given command and conditionally executes the statements following. The general syntax is:

   if test
   then
      commands     (if condition is true)
   else
      commands     (if condition is false)
   fi

then, else and fi are shell reserved words and as such are only recognised after a newline or ; (semicolon). Make sure that you end each if construct with a fi statement.

if statements may be nested:

   if ...
   then ...
   else if ...
       ...
     fi
   fi

The elif statement can be used as shorthand for an else if statement. For example:

   if ...
   then ...
   elif ...
     ...
   fi

[Home] [Search] [Index]