Geoscience Reference
In-Depth Information
Fig. 1.9 Typing example code in a terminal window
a Windows environment but are interested in testing a Linux OS without making
permanent modifications to their system, we suggest using the OSGeo-Live Virtual
Machine. Appendix B.1 deals with its installation and configuration.
While the focus of this topic is on command line geospatial tools, there is a strong
emphasis on shell programming, particularly the Bourne again shell (Bash). Bash
shell scripting, and indeed any scripting language, allows multiple commands to be
combined, facilitating automation. A shell script (shell program) is a text file that
contains commands that are interpreted by the shell.
Each command can be linked in a pipeline to combine several commands by
providing the output of one as input to the other. Shell scripts can also contain the
control structures common to the majority of programming languages (i.e. variables,
logic constructs, looping constructs, functions and comments). The main distinction
between shell programs and those written in C, C
, Java (to name but a few) is
that shell programs are not compiled for execution, but are readily interpreted by the
shell.
Throughout this topic we will present simple commands and shell scripts (mainly
written in Bash and some in Python). Some of the examples are relatively straight-
forward to use with a minimum of command line arguments and are therefore only
briefly discussed. Others will get more attention. The code snippets in the examples
mostly consist of a single line of code ( one-liners ). Typing the following command
in a terminal window will look something like Fig. 1.9 :
++
example_code -o options
 
 
Search WWH ::




Custom Search