Check file extention

PHOTO EMBED

Wed Jun 09 2021 10:16:48 GMT+0000 (Coordinated Universal Time)

Saved by @dimitri9494 #linux #shell-script

file="$1"

if [[ $file =~ \.bin$ ]] || [[ $file =~ \.hex$ ]]; then
    echo "OK" >&2
else
    echo "NOT OK" >&2
    exit 2
fi
content_copyCOPY

Check if the file extension of file given by parameter is the correct one