Overview
- What Is Bourne Shell?
- The Bourne shell (/bin/sh) is the original UNIX shell. It is basic and
slow. Most systems provided an extended version that supports functions.
- Portability
- There are at least two flavours of Bourne shell; with and without
functions. The simplest is portable to probably all UNIX systems; the
extended Bourne shell to most UNIX systems (I know only one that does not
provide it: NeXT.
- Pros and Cons
- Pros: Most standard shell. Cons: functionally poor; like all shells,
slower than Awk or Perl or C.
- How To Get It
- Should be installed on your UNIX system.
Working With The UNIX Bourne Shell
- Schema: lrschema.sh.
- Program model: executable UNIX script.
- Good for: complex scripts; portable to GNU systems.
- Files used/made: own work in myprog.mod; generates a
script called myprog.
- Module functions: module_function_name ()
- Private functions: private_function_name (). Since there
is no way to distinguish module functions from private functions, the schema
turns-off idle module checking.
- Naming style: any except -style=cobol.
- Limits: 254 modules, 254 events, 1000 states. The schema checks
at generate-time that the dialog does not exceed these limits. All tables
are defined dynamically, at runtime.
- Development cycle: run lr after you change the dialog or
.mod file. When you add a new module, run lr, then edit
the .mod file, then run lr again. Don't change the
generated script except for hacking - you'll lose your changes.
Example of code
Code fragments:
################# MODULE FUNCTION NAME #################
module_function_name ()
{
return # Empty module needs 'return'
}
private_function_name ()
{
the_next_event=$ok_event
raise_exception $error_event
}
See also: Note on UNIX shells.