Exercises: shell scripts (2)
- Write a shell script called
isint that checks
whether its argument looks like an integer value
Include suitable error checking and reporting
(e.g. missing argument)
- Write a shell script called
istext that checks
whether its argument is a text file
Include suitable error checking and reporting
(e.g. missing argument, not a file)
- Write a shell script called
iota to generate
a sequence of integers one per line, with usage:
iota
# gives 1 2 3 4 5 6 7 8 9 10 ...
iota lo
# e.g. iota 4 gives 4 5 6 7 8 9 10 ...
iota lo hi
# e.g. iota 4 8 gives 4 5 6 7 8
iota lo hi step
# e.g. iota 2 12 3 gives 2 5 8 11
|
Include appropriate error checking.
- Write a shell script called
prod to compute
the product of a sequence of numbers given one per
line on standard input
- consider what kind of errors might occur
- how should each be handled?
- Make a link from
prod called sum and
modify the script so that it behaves differently
depending on how it is invoked.
|