#!/bin/bash # #*************************************************************************** # Author: liwanggui # Email: liwanggui@163.com # Date: 2022-05-21 # FileName: imgtohtml.sh # Description: This is a test script # Copyright (C): 2022 All rights reserved #*************************************************************************** # if [[ -z $1 ]]; then echo "usage: $0 " exit 1 fi mime_type=$(file --mime-type $1 | awk '{print $2}') file_name=${1%.*} printf "" $mime_type "$(base64 $1)" > ${file_name}.html