Bourne Shell Tutorial
Bourne Shell Programming
- Pluses:
- rapid development cycle
- small and portable executable files
- direct access to Unix tool commands
- control structures, variables, etc.
- Minuses:
- sllloooowww (interpreted, multiple processes)
- data structures weak
- some things you "just can't do"
- Programming Process
- Write the program
- Make it executable
- Run it
- (Optional) Move it to your tools directory
- Control structures
- case:
case word in
pattern) commands ;;
pattern) commands ;;
pattern) commands ;;
...
esac
- if:
if command
then
true commands
else
false commands
fi
- for:
for var in wordlist
do
commands
done
- shorter for:
for var
do
commands
done
- while:
while command
do
commands
done
- until:
until command
do
commands
done
- Examples:
That's it! Assuming I made it this far! Thank you!