Juan Tapiador

Shell Programming

These materials are from a short course on shell (Bash) programming that I teach periodically. The course is organized into a number of topics, taught mostly sequentially. For each topic, there is a short text file providing a brief introduction, code examples, and sometimes, exercises and references. These files are not intended to replace a proper learning resource like a textbook. Instead, they serve as a resource for me to discuss topics and create scripts based on the fundamentals described within. Feel free to use them as you deem appropriate.

Contents

Download all contents: shellp.tgz
  1. The shell
  2. Simple commands
  3. Compound commands: pipelines
  4. Compound commands: lists
  5. Execution environment
  6. Redirections
  7. Shell scripts
  8. Hello world
  9. echo
  10. printf
  11. Variables
  12. Variables: declaration
  13. Variables: types
  14. Variables: scope and environment
  15. Variables: builtins
  16. Variables: read
  17. Command substitution
  18. Quoting and expansions
  19. Patterns: globbing
  20. Patterns: brace
  21. String operations
  22. Positional parameters
  23. Integers and arithmetic expressions
  24. Conditional statements
  25. Conditional statements 2
  26. Conditional statements 3
  27. case
  28. select
  29. Arrays
  30. for loops
  31. while loops
  32. until loops
  33. break and continue
  34. Functions
  35. The fork bomb
  36. Signals and traps
  37. Debugging
  38. xargs
  39. getopts
  40. eval
  41. Obfuscation
  42. Terminals
  43. Shell configuration

Resources

This is an eclectic collection of shell resources, with a primary focus on Bash. It includes official sources and design documents, programming guides and tools, information on coreutils internals, collections of shell scripts for study, and discussions on the UNIX philosophy.