diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-12-03 22:20:41 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-12-03 22:20:41 +0100 |
| commit | a3eb6de4044adfbd91e6a55dade03fab2547ba84 (patch) | |
| tree | e79455dd63cb7e3a935e3a8d1619b5be49411640 | |
| parent | 89977da7e3355c6fcfeafac66f8bd6ac1bdde9f6 (diff) | |
| download | memory-leaks-a3eb6de4044adfbd91e6a55dade03fab2547ba84.tar.xz | |
Add introductory guide to shells
| -rw-r--r-- | guides/shell-101.org | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/guides/shell-101.org b/guides/shell-101.org new file mode 100644 index 0000000..b09118b --- /dev/null +++ b/guides/shell-101.org @@ -0,0 +1,44 @@ +My tentative introductory guide to navigating a shell interface +(assuming Bash). + +🚧 These are rough notes meant for guiding in-person discussions; they +are somewhat terse. 🚧 + +* Moving around, invoking stuff + +With a file browser and a terminal emulator side-by-side: + +- ls, cd, mkdir, touch, rm; "/" = root +- globs +- arguments vs options (e.g. ls, diff) +- man, --help +- standard input/output/error: pipes, redirection +- writing scripts (shebangs: see bash(1) § COMMAND EXECUTION) + +* Shell language + +- ; & (e.g. sleep) +- && || (e.g. grep) +- if, for +- $? (e.g. grep, diff) +- [ +- variables +- functions, $@, $1… +- black-box model of a command: + - inputs: stdin, arguments, environment + - outputs: stdout, stderr, exit code + - side-effects: writing files, connect to network, … +- which, type: keyword ≠ builtin ≠ function ≠ program +- valar quotulis (valar escaepis); e.g. sort operator: [ foo '>' bar ] + +* Advanced + +- ( ) ≠ { }: try to set variables, or call exit +- (( )), $( ) +- glob ≠ regex +- bash extensions + - [[ + - <( ) + - |&, >& + - arrays +- job control: fg, bg, jobs, wait, kill, C-z |
