I am passing an argument with file name and extracting the file extension from the file name.
I am trying to verify whether the extenion provided is in with in the allowed file types. the allowed filetypes are txt,csv,zip,* . while testing if i pass the $fileext as sh , it is still prompting that sh as a proper file extension.
Please find the code below:
fileext=${filenm##*.} echo $fileext
if (("$fileext" == "txt")) || (("$fileext" == "csv")) || (("$fileext" == "zip")) || (("$fileext" == "*")) then echo "$fileext is a proper file extension" else echo "$fileext is not an appropriate file extension" fi
It will be very helpful if someone can let me know the mistake that i am doing here as it is showing the wrong message
Aucun commentaire:
Enregistrer un commentaire