Gotchas

Expansions

  • "~" - does note expand in quotes.
    • instead use "$HOME"

Control flow

hi() {
  # Return wont work as expected since it will exit out of parenthesis 
  # and not the hi function. Allowing this method to continue further.
  echo "blah" | grep o1 || (echo "nope"; return 1)

  echo "FINISHED in HI"
}

hi

WHY: because its () is a subprocess. See Parenthesis Spawn a Subshell: $() AND ()


Children
  1. Declare and Assign Masks Return Values
  2. Expansions
  3. Return in Paranthesis Does Not Return from Function
  4. Separate Failed Process Will Not Abort Script Even When Set E Flag Is Set
  5. dont-try-to-OR-after-source