home.


Bash: case statement

The case statement is simple enough, and notibily works with regular expressions:

case $SOMESTRING in
"starts_with_"*)
  # Uses a regex
  ;;
*)
  #anything else
  ;;
esac

esac is case backwards.


Tags: unix | unix-bash
Posted: Saturday 28 May 2016, 3:42PM

Edit on Github!
comments powered by Disqus