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 | edit source]- Introduction:
- Subshells
- Function Usage
- Variables
- Loops
- Conditional Statements
- Interactive Input
- Environment variables
- Parsing Command-Line Arguments (usage function)
- Miscellaneous topics
- Internal file separator (IFS)
- error handling
trap
[4][5], read https://www.linuxjournal.com/content/bash-trap-command - PID of last command:
echo "$!"
(See also:ps
See also
[edit | edit source]- AppleScript
- PowerShell, Windows scripting language
- CompTIA: Linux Administration Shells and Scripting
- zsh, default macOS shell since October 2019
- Wikibooks: Bash Shell Scripting
References
[edit | edit source]- ↑ https://www.mkssoftware.com/docs/man1/sh.1.asp
- ↑ https://en.wikibooks.org/wiki/Bash_Shell_Scripting#Brace_expansion
- ↑ https://tiswww.case.edu/php/chet/bash/bashref.html#Programmable-Completion
- ↑ https://wiki-dev.bash-hackers.org/scripting/bashchanges
- ↑ https://www.gnu.org/software/bash/manual/bash.html#Bourne-Shell-Builtins