hmm...
any ideas how to use the "$a" | tr "[:upper:]" "[:lower:]" (turns uppercase chars to lowercase) but somehow use the variable from a loop in it?
I have file names in a folder that should be checked for uppercase--
and any idea why my code makes duplicates even though I try to check it against my loop?
this is how I convert other characters (the convert is called in a for loop looping through all files in a folder:
(loop is: for filen in *)
convert()
{
gammeltnavn=$filen #oldname = thefile
nyfil=$gammeltnavn #newfile = oldname
nyfil=${nyfil/å/aa} # turns å into aa ....
nyfil=${nyfil/ø/oe}
nyfil=${nyfil/æ/ae}
nyfil=${nyfil/ /_}
#echo "$filen" | tr "[:upper:]" "[:lower:]" ### I want to turn uppercase to lowercase here, but this method didnt work
if [ "$gammeltnavn" == "$nyfil" ]; # if olname equals newfile
then
echo "ingen endring!!!!!!!!!!" # no change (would simply mean it tries converting something that dont need converting)
echo
continue
else
echo -n "Ulikt navn---" # different name
if [ "$nyfil" != "$filen" ]; then # opposite, if name is NOT equal, the file should be changed
echo "Filnavn endres" # filename changed
#mv $gammaltnavn $nyfil # does the actual changing
elif [ $nyfil == $filen ]; then # FAILS? this should check if the file made, already exists, but it still creates files with same name as in folder
echo "filnavn eksisterer fra før" #+ so it should not create a duplicate... yet it does
echo "oppgi filnavn.endelse" # prompts user for filename that dont match old files
read inn
#mv $gammaltnavn $inn
fi
fi