Running Scripts in Sherpa
![[CXC Logo]](/ciao/imgs/cxc-logo.gif)
Sherpa Threads (CIAO 4.1)
[S-Lang Syntax]
OverviewLast Update: 19 Jun 2009 - original version Synopsis: This thread lists the available options for running scripts of Sherpa commands in the S-Lang interface of Sherpa. In this thread we refer to a "script" as an ASCII file containing a list of S-Lang Sherpa commands. |
Running scripts in S-Lang
1. To run a script of S-Lang Sherpa commands within the S-Lang environment before starting a Sherpa session:
unix% sherpa scriptname
or
unix% sherpa -l slang scriptname
- add these lines to the top of the script of S-Lang Sherpa commands so that you can execute the script from the Unix command line without having to explicitly start a Sherpa session:
#! /usr/bin/env slsh
require("sherpa");
- make the script executable
unix% chmod +x scriptname
- and run the script by typing the script name at the Unix prompt.
unix% ./scriptname
S-lang Sherpa will exit automatically when the script completes.
2. If you would like to run a script from within an S-Lang Sherpa session, you can use the "evalfile" command:
unix% sherpa
-----------------------------------------------------
Welcome to Sherpa: CXC's Modeling and Fitting Package
-----------------------------------------------------
CIAO 4.1.2 Thursday, April 2, 2009
sherpa-1> evalfile("scriptname");
History
| 19 Jun 2009 | original version |
