Next: Arguments, Previous: Command line, Up: Command line [Contents][Index]
On the command line, the first thing you enter is the name of the
program you want to run. After that you can specify two types of
input: arguments and options. Arguments are those
tokens that are not preceded by any hyphens (-
), the program
is suppose to understand what they are without any help from the
user.
Arguments can be both mandatory and optional and since there is no
help from you, their order might also matter (for example in
cp
which is used for copying). The outputs of
--usage and --help shows which arguments are
optional and which are mandatory, see --usage. As their name
suggests, options are only optional and most of the time you
don’t have to worry about what order you specify them in.
In case your arguments or option values contain any of the shell’s
meta-characters, you have to quote them. If there is only one such
character, you can use a backslash (\
) before it. If there
are multiple, it might be easier to simply put your whole argument or
option value inside of double quotes ("
). In such cases,
everything inside the double quotes will be seen as one ‘word’.
For example let’s say you want to specify the Header data unit (HDU) of
your FITS file using a complex expression like 3;
images(exposure > 100)
. If you simply add these after the
--hdu (-h) option, the programs in Gnuastro will
read the value to the HDU option as 3
and run. Then, Bash
will attempt to run a separate command images(exposure >
100)
and complain about a syntax error. This is because the semicolon
(;
) is an ‘end of command’ character in Bash. To solve
this problem you can simply put double quotes around the whole string
you want to pass as seen below:
$ astimgcrop --hdu="3; images(exposure > 100)" FITSimage.fits
Alternatively you can put a \
before every metacharacter in
this string, but probably you will agree with us that the double
quotes are much more easier, elegant and readable.
Next: Arguments, Previous: Command line, Up: Command line [Contents][Index]
Read in other formats.
GNU Astronomy Utilities manual, November 2015.