Some bash stuff
- expand aliases:
shopt -s expand_aliases
- exit on fail:
set -e
(upon a command exiting with a non-zero status) - trap the exit signal:
trap 'rm -f foo' EXIT
(e.g. to perform cleanup upon exit) while IFS=',' read -r var_name; do
echo test`which sh`
awk
awk ‑F: 'OFS="-" { print $1 $3 $NF }' /etc/passwd
fortune | awk '{ print toupper($0) }'
awk '$1 ~ foo { print $3 }'
- comparison operators: ==, !=, <, <=, (etc), ~ (match, e.g. contain), !~ (not match)
$NF
- last field