upper and lower

 Recently found my prompted blinking at a folder with a bunch of all capital letter files in it. This bash shell script made them lowercase


lower upper

#!/bin/bash
UPPER=$1
LOWER=`echo $UPPER | tr '[A-Z]' '[a-z]'`
echo 'mv ' $UPPER $LOWER
mv $UPPER $LOWER

#!/bin/bash
LOWER=$1
UPPER=`echo $LOWER | tr '[a-z]' '[A-Z]'`
echo 'mv ' $LOWER $UPPER
mv $LOWER $UPPER




This works fine on a single file, next you want to use a for loop to operate on a whole bunch of files
for f in $(ls); do lower $f; done



The opinions expressed in this post do not necessarialy reflect those of blogger or our sponsor:



No comments: