convert to lowerercase in shell script code example
Example 1: convert all files to lowercase using shell script
#!/bin/sh
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done
Example 2: convert capital letters to lowercase in shell script
x="HELLO"
echo $x # HELLO
y=${x,,}
echo $y # hello
z=${y^^}
echo $z # HELLO