Software Development Degree BTO120 Lecture Notes - Lecture 12: Teleprinter, Terminal Capabilities, Computer Terminal
Document Summary
Lecture 12 - advanced scripting - trap; functions; Trap specifies action to take when a signal is detected. Trap "rm -f /tmp/*31209*; exit" int - action for -c. Must be defined before use, usually at the beginning of the script. Invoked by using name, can pass arguments. Arguments replace the , , variables during function execution. return statement can be used to return a numeric value, same as exit from a script. To return strings, either place in a variable, or use command substitution when invoking the function. An example, the function placing the result into a variable; notice that all variables are global: ==> cat functions. example1 add() { sum=0 for num do sum=0 done add 23 45 -17 echo . ==> _ add() { sum=0 for num do sum=0 A similar example, using the return statement: A dumb terminal is basically a text display with a keyboard, similar to an old teletype terminal.