I am trying to scan a file-name looking for the word "flag" however, I want to ignore case. So whether the file contains upper or lower case "FLAG" i want to do something. This is a bash script. Here is the code I am developing.
if [[ "$1" =~ "FLAG" ]]; then
Thanks in advance.
If you want to match words then use equal to sigh (=) alone ~ is not needed and remove the quotes surrounding $1.
if [[ $1 = "FLAG" || $1 = "flag" ]] # matches the given 2 combination or if [[ $1 = [Ff][Ll][Aa][Gg] ]] # matches any combination of word flag
Thanks. I like the second option the best. Thanks for the help.