Lower to Upper and Vice Versa

Script pour passer des caractères Lower en Upper et vice versa


#!/bin/ksh
#
# Mettre en Lower les Upper donner et vice versa
#

lcu(){
#set -vx
    case "$1" in
        a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)
        n=$(printf "%d" "'$1")
        n=$((n-32))
        printf \\$(printf "%o" $n)
                  ;;

        A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z)
        n=$(printf "%d" "'$1")
        n=$((n+32))
        printf \\$(printf "%o" $n)
                  ;;
    esac
}
word="$1"
for((i=0;i<${#word};i++))
do
    ch=${word:$i:1}
    lcu $ch
done


Previous page: Acces SMTP send mail
Page suivante : Convert base 10 36 Hexa Dec Bin