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

Поисковые слова: asteroid
Examples of passing arguments to the shell

Examples of passing arguments to the shell

To pass several arguments from the command line to the shell:

   cat first_5args
   # This script echoes the first five arguments
   # supplied to the script
   echo The first five command line
   echo arguments are $1 $2 $3 $4 $5
   first_5args mines a pint john o.k.
   The first five command line
   arguments are mines a pint john o.k.

This passes the arguments represented by parameters $1 through $5 to the shell script.


To pass the value of each positional parameter to the shell script:

   cat printps
   # This script converts ASCII files to PostScript
   # and sends them to the PostScript printer ps1
   # It uses a local utility "a2ps"
   a2ps $* | lpr -Pps1
   printps elm.txt vi.ref msg

This processes the three files given as arguments to the command printps.


[Home] [Search] [Index]