Документ взят из кэша поисковой машины. Адрес оригинального документа : http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.5.html
Дата изменения: Fri Jan 17 12:43:20 1997
Дата индексирования: Mon Oct 1 23:56:55 2012
Кодировка:
Testing for files and variables with the test command

Testing for files and variables with the test command

The shell uses a command called test to evaluate conditional expressions. Full details of this command can be found in the test manual page. For example:

   if test ! -f $FILE
   then
     if test "$WARN" = "yes"
     then
       echo "$FILE does not exist"
     fi
   fi

First, we test to see if the filename specified by the variable $FILE exists and is a regular file. If it does not then we test to see if the variable $WARN is assigned the value yes, and if it is a message that the filename does not exist is displayed.


[Home] [Search] [Index]