Skip to content

Instantly share code, notes, and snippets.

@localzet
Created January 16, 2024 17:15
Show Gist options
  • Save localzet/c0bb144e5ffaf3c9bfa4b414a5d73d70 to your computer and use it in GitHub Desktop.
Save localzet/c0bb144e5ffaf3c9bfa4b414a5d73d70 to your computer and use it in GitHub Desktop.
mime.type generator
#!/bin/bash
MIME_TYPES=$(wget -qO- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types | sed '/^#/d')
echo "types {" > ./mime.types;
echo "$MIME_TYPES" | while read -r line
do
TYPE=$(echo $line | awk '{print $1}')
EXTENSIONS=$(echo $line | cut -d' ' -f2-)
for EXT in $EXTENSIONS
do
echo " $TYPE $EXT;" >> ./mime.types;
done
done
echo "}" >> ./mime.types;
echo "Файл mime.types успешно создан."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment