Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.6.1.1.html
Дата изменения: Fri Jan 17 12:43:20 1997 Дата индексирования: Tue Oct 2 02:04:59 2012 Кодировка: |
To specify an action when a word matches the pattern:
cat diary #!/bin/sh today=`date +%m/%d` (presents the date in the format 01/31) case $today in 07/18) echo "Aonoch Mhor" ;; 07/21) echo "Ben Wyvis" ;; 08/02) echo "Buicheille Etive Mhor" ;; 08/03) echo "Slioch" ;; *) echo "Wet..low level today" esac date +%m/%d 07/18 diary Aonoch Mhor
The value for the word $today is generated by the date command. This is then compared with various patterns so that the appropriate commands are executed.
Note the use of the pattern *, this can be used to specify default patterns as the * character is the shell wildcard character.