Using variables#

Arithmetic evaluation#

echo 1 + 1
echo $((1+1))
echo $[1+1]
echo $[3/4]
echo $[3/4] | bc -l

Using exitcodes#

cd /noexisting > /dev/null
echo $?
echo $?

Capturing output#

TODAY=$(date +%Y-%m-%d)
echo $TODAY
TODAY=`date +%Y-%m-%d`
echo $TODAY

Reading user input#

read -p "Enter your name: " name
echo "Hello $name"