Bash
Snippets
-
Args — Manipulating the input command line arguments
-
Colours — How to support colours in a bash script
-
Conditionals — Various testing on conditional events or variables (exit test, variable defaults).
-
Environment — Introspecting and manipulating the shell environment
-
Substitution — Search, find and replace from the command line
-
User Interaction — Interacting with the user for, e.g. input.
Configuration
- .profile - general shell commands for use with any shell (i.e. PATH etc)
- .bash_profile - super simple, just source .profile and .bashrc if they exist
- .bashrc - shell specific commands (command line prompt, aliases, etc)
MacOSX
- ANSI color codes - always use printf, not echo
- Terminal → Preferences → General → Command → /bin/bash
- NB: Terminal will always run a login shell