I am writing a bash program that searches for .pgn (portable game notation) files in a folder. But in my program, .pgn extensions are not case sensitive. It means that they could be either lowercase or uppercase or a combination of the two. (.Pgn, .PGN, .pGn, .etc).
So for checking the extension I do this :
extension="${file: -4}"
extension="${extension,,}"
if [ "${extension}" == ".pgn" ]
I am wondering if there is a way to do this, in a shorter way. By shorter, I mean do it all in the if
statement.
Thank you in advanced for helping me.