XSPEC commands can be written into a file and then executed by entering
Alternatively, from the shell prompt
% xspec - filename &
for batch execution (remember to end the script in file filename.xcm with the exit command if you want the program to terminate after completion!). Note that the default suffix for xspec scripts is .xcm
The save command writes the current XSPEC status to a command file (savexspec.xcm by default), which later can be run to reset XSPEC to the same configuration. XSPEC also has a mechanism to save the current status automatically. This is controlled through the autosave command. This command is very useful when reading a large number of data sets and/or fitting complicated models. If autosaving is operating (the default) then the equivalent of
XSPEC12> save all xautosav.xcmis run after each command, so if a disaster occurs it is possible to recover.