Update some scripts

This commit is contained in:
Alexander Gehrke 2023-03-02 16:02:42 +01:00
parent 83fb9a083a
commit 697c7e105f
5 changed files with 33 additions and 24 deletions

View file

@ -5,11 +5,10 @@
if [[ $2 ]]; then
encoding=$2
else
encoding=$(chardetect "$1" | grep -oP '(?<=: )\S*')
encoding='utf-8'
#encoding=$(chardetect "$1" | grep -op '(?<=: )\s*')
fi
if ! iconv -f $encoding <<<"" &> /dev/null; then
cat "$1"
elif [[ $encoding != 'utf-8' ]]; then
if [[ $encoding != 'UTF-8' ]]; then
iconv -f $encoding -t 'utf-8' < "$1" | mdcat /dev/stdin
else
mdcat $1