Can I make this shell script faster?
I use nmh for my mail; plain text mails are displayed with less(1). Unfortunately, since my xterm uses UTF-8 by default, any ISO8859 mails will tend to have �’s everywhere.
I thought I’d fix this by piping output through a simple script first:
#!/bin/sh while read input do echo $input | file - | grep 8859 > /dev/null if [[ $? = 0 ]]; then echo $input | iconv -f ISO-8859-1 -t UTF-8 else echo $input fi done
$ time u8conv.sh < /etc/hosts >/dev/null 0m0.22s real 0m0.11s user 0m0.11s system $ time cat /etc/hosts >/dev/null 0m0.00s real 0m0.00s user 0m0.00s system
Many thanks to the forum regulars who put time and effort into helping others solve their problems.
|Thread||Thread Starter||Forum||Replies||Last Post|
|ask for a shell script||Simon||Programming||5||27th April 2010 01:07 AM|
|shell script compare md5 sum||bsdnewbie999||Programming||1||11th April 2009 02:20 PM|
|incrementing within a shell script?||spiderpig||Programming||5||29th September 2008 08:12 PM|
|Shell Script.||bsdnewbie999||Programming||21||15th July 2008 07:54 AM|
|shell script with input||c0mrade||Programming||5||13th July 2008 04:33 AM|