3
*, ?, [set], [^set], {variant1,variant2,...}
7
${#var} - Length of string
8
${var:FIRST:N} - Substring
9
${var:-word} - var?var:word
10
${var:+word} - var?word:null
11
${var:?mess} - var?var:abort(mess)
12
${var#pattern} - If the pattern matches the beginning of the variable
13
value, delete the shortest part that matches and return
14
the rest (shell pattern, not regexp)
15
$(var##pattern} - Deletes longest part
16
${var%pattern} - Shortest part in the end
17
${var%%pattern} - Longest part in the end
19
$(( expr )) - Evaluate expression
20
$(command) - Equivalent to `command`
29
if cond; then ...; elif cond; then ...; else ...; fi
32
pattern11|pattern12|... } statements ;;
35
+ Shell patterns are allowable in the patterns.
37
for name [ in list ] ; do statements; done
38
for ((x=1 ; x<3 ; x++ )) do echo $x; done
39
while/until codition ; do statements; done
44
select name in xxx zzz quit; do echo $name; done
45
Asks user for selection (in loop)
46
read name - Reads line into the $name
47
read a b - Read 1st word in to a and rest into b
48
read -t 300 var - Read with 300 second timeout
58
$# - Number of arguments
59
$* - All arguments ("$1" "$2" ...)
62
$! - pid of last background process
65
while getopts ":ab:c" opt; do
69
$OPTARG is the option's argument;;
73
shift $(($OPTIND - 1))
77
trap "" signal-list - Ignore signal
78
trap "cmds" signal-list - Execute commands if signal is caught
79
trap signal-list - Reset signal to original condition
84
set -o noexec sh -n - Check syntax, don't execute
85
set -o verbose sh -v - List commands before running
86
set -o xtrace sh -v - List commands after running
87
set +o <PTION> - Turns option off
91
wait - Wait completion of background processing
92
tr - Translate or delete characters
93
tee - Read from standrd input and write to stdout and files
94
xargs - Executes commands on standart input
95
find . -type f -print0 | xargs -0 rm -f
96
seq FIRST INCREMENT LAST - sequence of numbers