[Edit]
+
0
-
0
Bash - check if file is PNG file using magic numbers
1 2 3 4 5 6if [ "$(xxd -s 0 -l 4 -p "/path/to/image.png")" = "89504e47" ] then echo "image.png is PNG file" else echo "image.png is not PNG file" fi
1 2 3 4 5 6if [ "$(xxd -s 0 -l 4 -p "/path/to/image.png")" = "89504e47" ] then echo "image.png is PNG file" else echo "image.png is not PNG file" fi