I have the following code to test if the file held in $arg is not one of several file extensions. In an effort to learn I want to know if there is a more correct, more compact way to do this.
if ! [[ -f "$arg" && ( $arg = *.mkv || $arg = *.mp4 || $arg = *.mp3 || $arg = *.flac || $arg = *.avi) ]] ; then
echo -e "\"$arg\" is an invalid directory, filename or file format\n"
fi
Aucun commentaire:
Enregistrer un commentaire