Bash programming

(Redirected from Bash Programming)

The context for this course is set by the Wikipedia article: the Unix Shell. All examples in the course are executed in the Bash shell. Occasional references are made to the other two more similar shells: sh, and ksh.

The bash shell implements the significant facets of sh and ksh, in alleged upward compatibilty, and has some features of csh, which is quite a different model than the sh, ksh, bash[1] progression.

Different from most shell instruction, and since there is plenty of excellent shell material available, this course assumes the shell function is the organizing principle of any shell program. This course will make frequent use of that material.

Bash is now the pre-eminent user shell in Unix / Linux / and any *nix environment, including BSD and macOS until October 2019 that was replaced by zsh.

Bash Features includes command history, brace expansion[2] and command-line completion[3] among others.


Contents

edit
  1. Introduction:
    1. Bash command-line completion
    2. Bash History
  2. Subshells
  3. Function Usage
  4. Variables
  5. Loops
    1. For Loop
    2. While Loop
    3. Do While Loop
  6. Conditional Statements
    1. Shortcut if Statement
    2. If, Else-if, Else Ladder
    3. Switch / Case Statement
  7. Interactive Input
  8. Environment variables
  9. Parsing Command-Line Arguments (usage function)
  10. Miscellaneous topics
    1. Internal file separator (IFS)
    2. error handling trap[4][5], read https://www.linuxjournal.com/content/bash-trap-command
    3. PID of last command: echo "$!" (See also: ps

See also

edit

References

edit