bash -n : test syntax without running the script shopt -s extglob : turns on extra glob features of the shell (for regexp tests) set -o noclobber - prevents overwriting files
- {} : groups a series of commands.
- () : groups a series of commands and executes them in a subshell
- $() - the newer syntax for ``
- $(( )) : lets you do arithmatic inside
-
| - will overwrite a file even with noclobber on
- <</EOF - prevents evaluating variables
- read -p "your prompt" variable
- $? - the exit status of the last command run
- cmd1 && cmd2 && cmd3 - will shortcircuit if the previous command fails
- nohup - ignores hangup from closing a bash shell (for running headless cmds)
- env is a subset of set
- let y+=3 : won't echo result
- ${1} - first arg
- $* - all arguments
- $@ - all args quoted?
- ${#} - the number of args
- grep -l : prints filenames only
- grep -v : the stuff to ignore (grep "whatever" file | grep -v "but ignore this pattern")
[ 4 -lt 5 -a 6 -eq 6 ]
- comparisons: -lt, -eq, -ne, -ge, etc.
- booleans: -a (and), -o (or)
[ '4' == '4' -a '6' != '5' ]
- comparisons: ==, !=, >, <=, etc.
[[ ]] - more powerful comparison, not supported in older shells
- find --follow : will follow simlinks
- find --iname : case insensitive filenames