Bash script check if image is animated png (apng)

前端 未结 3 932
我寻月下人不归
我寻月下人不归 2021-01-23 04:20

Trying to figure out a way in my bash script to check if a file is an animated PNG (apng) file. In my case I want to ignore it if it is . Any ideas ?

UPDATE: The answer

3条回答
  •  故里飘歌
    2021-01-23 05:05

    First extract the extension of your file using expr.

    Check http://tldp.org/LDP/abs/html/string-manipulation.html:

    expr match "$string" '.*\($substring\)'

    Extracts $substring at end of $string, where $substring is a regular expression.

    Then compare extracted extension with ".png"

提交回复
热议问题