#!/bin/sh # # Convert files from latin1 to iso646-se or iso646-se2 # from_chars='\304\326\305\344\366\345' to_chars='[\\]{|}' if [ "$1" = "-2" ]; then from_chars='\311\304\326\305\334\351\344\366\345\374' to_chars='@[\\]^`{|}~' shift fi if [ $# -ne 0 ]; then trap 'rm -f $tmpfile; exit' 0 1 2 3 13 15 tmpfile=$(mktemp ~/.l2s.XXXXXX) || exit 1 for f in "$@"; do tr "$from_chars" "$to_chars" <"$f" >$tmpfile mv -f $tmpfile "$f" done else exec tr "$from_chars" "$to_chars" fi .