There is a more-robust technique for passing information between Starlink applications; it does not rely on the formatting of the output. Where an application writes output parameters (otherwise called results parameters), you may use the parget command of KAPPA to write to standard output the value or values associated with a parameter for a named application. In a script we want to assign the value to a shell variable. Let's see how that compares with obtaining the same mean value as before.
stats accept > /dev/null
set average = `parget mean stats`
This runs stats, but redirects the output
to the null device as the output is not wanted. However, this does
not prevent the output parameter called MEAN from being assigned the
mean value. parget retrieves this value, which is then assigned
to variable average. Note that parget retrieves parameter
values for the last invocation of the task. Thus if you wanted the
standard deviation too, you would only need to issue the stats
command once (as shown below).
stats \\ > /dev/null
histpeak use=a sfact=0 device=! accept > /dev/null
set mean = `parget mean stats`
set stdev = `parget sigma`
set kurtosis = `parget kurt histpeak`
The kurtosis is obtained via the KURT output parameter of the histpeak command of ESP.
C-shell Cookbook