bash check if files with extension exists code example Example: if file has extension bash if [[ ${file: -3} == ".gz" ]]