The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

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]



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру