5
rated 0 times
[
5]
[
0]
/ answers: 1 / hits: 699
/ 3 Years ago, sun, august 1, 2021, 5:22:35
I have found that this command gives me the mime type from a file:
file --mime-type dog.jpeg
Output:
dog.jpeg: image/jpeg
I am now trying to create a bash checks if the mime is jpeg og png. However I am a bit stuck:
#!/bin/bash
$file_mime="file --mime-type dog.jpeg"
mime=`"${file_mime#*:}"`
if(mime=='image/jpg' OR mime=='image/png') do:
echo"Jpg or png"
done
Output:
./bash.sh: line 2: =file --mime-type dog.jpeg: command not found
./bash.sh: line 3: : command not found
More From » bash