next up previous contents
Next: scripts terminal prompt Up: scripts Previous: scripts search path

scripts parameters

It is possible to use parameters with scripts. To do this you enter the parameters on the line where you started the script. Thus,

xsel >  @test one two three

would cause XPI to open and read the test script using three parameters one, two, and three. When XPI is reading the script it will replace %n% with parameter n. Thus, %1% will be replaced with one, %2% with two, etc. The following illustrates a script that expects to be run with parameters:

make obs %1% choose %2% ...bin %3%

If you forget to enter the three parameters, then XPI will replace %n% with a null string.

It is possible for a script to call another script and pass in parameters. Thus,

@deeper first %2% %3%

is a valid line in a script. In this example, the first parameter is first, whereas the next two parameters will be set equal to parameters 2 and 3 of the current script. Also quotes can be used to denotes a single parameter with embedded spaces, or other magic characters. Thus,

@file ̉This is all one" two three

would pass three parameters, and the first parameter would be the string This is all one.


next up previous contents
Next: scripts terminal prompt Up: scripts Previous: scripts search path
Keith Arnaud
2006-07-26


HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Monday, 19-Mar-2012 14:16:46 EDT