Originally published at: https://www.cyberciti.biz/faq/bash-check-if-string-starts-with-character-such-as/
My bash shell script read a config file line-by-line using a bash while loop. I need to check if a string stored in $var starts with some value such as # character. If so I need to ignore that value and read the next line from my config file. How do I check if variable begins with # in bash shell scripting running on a Linux or Unix-like operating systems?