Документ взят из кэша поисковой машины. Адрес оригинального документа : http://comet.sai.msu.ru/UNIXhelp/scrpt/scrpt2.3.html
Дата изменения: Fri Jan 17 12:43:19 1997
Дата индексирования: Mon Oct 1 23:59:50 2012
Кодировка:

Поисковые слова: viking 2
Reading user input

Reading user input

To read standard input into a shell script use the read command. For example:

   echo "Please enter your name:"
   read name
   echo "Welcome to Edinburgh $name"

This prompts the user for input, assigns this to the variable name and then displays the value of this variable to standard output.

If there is more than one word in the input, each word can be assigned to a different variable. Any words left over are assigned to the last named variable. For example:

   echo "Please enter your surname\n"
   echo "followed by your first name: \c"
   read name1 name2
   echo "Welcome to Glasgow $name2 $name1"

[Home] [Search] [Index]