If you are using bash 4 you can use the following approach: x="HELLO" echo $x # HELLO y=${x,,} echo $y # hello z=${y^^} echo $z # HELLO