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.




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

Last modified: Tuesday, 10-Jan-2023 11:03:00 EST

HEASARC Staff Scientist Position - Applications are now being accepted for a Staff Scientist with significant experience and interest in the technical aspects of astrophysics research, to work in the High Energy Astrophysics Science Archive Research Center (HEASARC) at NASA Goddard Space Flight Center (GSFC) in Greenbelt, MD. Refer to the AAS Job register for full details.