Skip to content

Conditions¤

Single line¤

[[ "x" == "x" ]] && echo "Ok!"
[[ ${value} > 0 ]] && result="yes" || result="no"

Multi line¤

counter=0
if [[ "${counter}" == 0 ]]; then
  echo "0"
fi
zone=$(hostname) # my-pc-01
if [[ "${zone}" == my* ]]; then
  echo "${zone} starts with my*"
else
  echo "${zone} doesn't start with my*"
fi
Back to top