Skip to content

Instantly share code, notes, and snippets.

@mhamilt
Created November 17, 2020 11:50
Show Gist options
  • Save mhamilt/c403b15f1563275fc083f601ab905db1 to your computer and use it in GitHub Desktop.
Save mhamilt/c403b15f1563275fc083f601ab905db1 to your computer and use it in GitHub Desktop.
Shell Expansion Modes

Modes

  • Parameter Expansion: ${}
  • Command Substitution: $()
  • Arithmetic Expansion: $(())

Examples

Parameter Expansion

for file in $(ls); do echo "hello ${file}"; done;

Command Substitution

for file in $(ls); do echo hello $file; done;

Arithmetic Expansion

echo $((1+1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment