Session contents¶
Text processing with sed¶
- Use of
!for negation - Use of
-n,-iand-fflags - Use of
g,p, andwcommands
In [ ]:
Variables¶
- Variables
${var} - Length of variable
${#var} - Removing substrings
${var#},${var##},${var%},${var%%} - Pattern substitution
${var/p/r},${var//p/r} - Prefix and suffix substitution
${var/#p/r},${var/%p/r} - Use of
declarewith-i,-rattributes
In [ ]:
Arrays¶
- Index and associative arrasys with
decalre -a,declare -A - Indexing with
$arr,${arr[0]},$arr[@]
In [ ]:
Branching¶
if
if CONDITION then;
commands
fi
In [ ]:
case
case EXPR in
PATTERN)
commands ;;
Pattern
commands ;;
esac
In [ ]:
Looping¶
fortype 1
for EXPR in Sequence
do
commands
done
In [ ]:
fortype 2
for (( i=0; i<n; i++ ))
do
commands
done
In [ ]:
while
while Condition
do
commands
done
In [ ]:
until
until Condition
do
commands
done
In [ ]:
Process control¶
&,fgandCtrl-zbgps,ps -a,ps -ejobskilland kill signalsman kill,kill -l,man signal
In [ ]: