Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 964 Bytes

lists.md

File metadata and controls

38 lines (32 loc) · 964 Bytes

Shell behaviors and data

"Things" that can be evaluated/manipulated by a shell:

  • strings (literals, other...)
  • variables
  • arithmetic
  • builtins
  • subshells
  • forked processes (non-shell)
  • File contents (reading)
  • File contents (writing/appending)
  • Temp files (reading, writing...)
  • Shell builtins/operators/etc via 'eval'

...These can be evaluated as...

  • nothing (e.g. no output captured from a subshell)
  • strings
  • ints
  • floats (...not in most shells!)
  • arrays of strings
  • assoc-arrays of strings (fairly recent in Bash)
  • string-streams (e.g. w/ pipes & redirection)
  • file-handles
  • interpretable shell code
  • in Nu/PowerShell/etc: structured data of some kind

Strings/code have multiple levels of "expansion." In Bash, in order:

  1. Brace expansion
  2. Tilde expansion
  3. Together:
    • Parameter expansion
    • Arithmetic expansion
    • Command substitution
  4. Word splitting
  5. Pathname expansion