User Tools

Site Tools


tips:linux:changecase

Changing the case of a variable or filename in a shell script

Converting a variable to upper or lower case can be accomplished using tr.

For example:

#!/bin/sh
LOWER="erik"
UPPER=`echo $LOWER | tr a-z A-Z`
echo $UPPER

will output:

ERIK
tips/linux/changecase.txt · Last modified: 2009/06/08 14:59 by erik