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

Поисковые слова: dust
Example of using the && operator

Example of using the && operator

To notify the user about the outcome of a previous command:

   cat deliver
   #!/bin/sh
   # usage: deliver username  filename
   { cat $2 | write $1 ; } && echo done

The user types a command such as:

   deliver keith greeting

The first command { cat $2 | write $1 ; } concatenates and displays the message held in the file greeting and pipes the output through the write command whose argument is the name of the user to whom the message is to be sent.

Note the use of the positional parameters $1 and $2. The ; (semicolon) is needed to sequentially execute the preceeding pipeline.

If this command is successful, the message done is displayed on standard output.


[Home] [Search] [Index]