19. 脚本:判断文件后缀

4.判断文件名后缀脚本

vim is_jpg_file.sh

#!/bin/bash
if expr "$1" ":" ".*\.jpg" &> /dev/null;then
    echo "yes,this is *.jpg file"
else
    echo "no,this is not *.jpg file!!!"
fi
bash is_jpg_file.sh aaaaaaaaa.jpg

最后更新: 2022-02-19 13:59:07