Next: Shell script arguments: positional
Up: BOURNE Shell Programming
Previous: Shell variables
- The special shell characters used to separate words are termed
internal field separators and are defined by the shell variable
IFS
- Several commands on the same line must be separated by a semicolon
- A script can use pipes and redirection both internally and externally,
that is pipes and redirection can be part of the commands within a script
and the script as a whole can use pipes and redirection to control input
and output
- Interactive scripts are based on UNIX shell commands read and
echo
- The read command can be followed by a list of variable names. If
the response consists of several words, the first variable gets the first
word, the second variable the second word and so on.
If there are more words than variables, all left-over words get assigned to
the last variable.
If there are more variables than words, the unused variables are not assigned
values.
- Example:
read name
echo Hello $name
Roger Hampel
Mon Feb 2 09:39:25 MET 1998