?login_element?
?pathlinks? – Rev 344
Blame |
Last modification |
View Log
| Download
#!/bin/bash
# usage: 1251to866.sh filename
# make the conversion
iconv -f cp1251 -t cp866 $1 >/tmp/111.111
if [ $? -ne 0 ]
then
echo Error converting $1!
exit 1
fi
# reverse conversion
iconv -f cp866 -t cp1251 /tmp/111.111 >/tmp/222.222
if [ $? -ne 0 ]
then
echo Error back-converting $1!
exit 1
fi
# compare reverse converted file with the original
diff $1 /tmp/222.222
if [ $? -ne 0 ]
then
echo Error comparing $1!
exit 1
fi
# comparison ok, replace the file
cp /tmp/111.111 $1
# remove temporary files
rm -f /tmp/111.111
rm -f /tmp/222.222
exit 0