Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/pget.html
AHELP for CIAO 4.16

pget

Context: Tools::Parameter

Synopsis

Get parameter values

Syntax

pget [-abort] toolname parameter [ parameter2 ... ]

Description

`pget' gets the value of the specified parameter(s) from the given parameter file. All redirections and shell evaluations are performed.


Examples

Example 1

pget dmlist infile

Return the value of the infile parameter

Example 2

pget dmlist infile opt

Returns the value of the infile and opt parameters, one per line.

Example 3

pget dmlist infile.p_value

Will return the actual string stored in the parameter file for the value field of the parameter. Redirections and shell evaluations are NOT performed.

Example 4

pget -abort blah.par boo

The '-abort' option causes pget to exit with an error when a parameter file specifies an inappropriate value. For example, if blah.par contained

boo,i,h,notaninteger,,,"bad value"

the above command would exit with an error, rather than prompting for a valid value (as it would if '-abort' were not given). This can be useful in scripts, where prompting for a valid value could cause a script to hang indefinitely.


Parameters

name type ftype reqd
parameter_file string input yes
parameter string input yes
-abort notype    

Detailed Parameter Descriptions

Parameter=parameter_file (string required filetype=input)

Parameter file from which to retrieve data

Name (plus optional path) of parameter file to get values from

Parameter=parameter (string required filetype=input)

Name of parameter

Name of parameter to retrieve. Optionally can use the various parameter attributes listed below to return those values.

Parameter Attributes
Qualifier Description
p_mode Whether the parameter is prompted for or not
p_value The value of the parameter. If the parameter is a redirected, this returns the redirection string rather than what the redirection evaluates too.
p_min Minimum value allowed or a "|" separated list of values.
p_max Maximum value allowed
p_prompt The parameter prompt
p_type The data-type, or class, of the parameter. The allowed values are: 's' (string), 'f' (file), 'r' (real, floating-point value), 'i' (integer valuer), 'b' (boolean yes|no value).

Parameter=-abort (notype)

Abort flag

If the parameter file contains an invalid value for the requested parameter, exit with an error (instead of prompting for a valid value).


Bugs

There are no known bugs for this tool.

See Also

concept
parameter
tools::header
dmhistory, dmkeypar, dmmakepar, dmreadpar
tools::parameter
paccess, pdump, pline, plist, pquery, pset, punlearn