- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi Experts,
I am trying to write a shell script for converting upper case names of .cpp & .h files into lower case,
my script is checking if the file is not directory, if it was directory it will print a warning,
then it will check if the file name is not in lower case already, if it is, then it prints a warning message
and it checks also if there exists a file with same lower case name, if there was it will print a warning again,
at the end it will convert the name of the file into lower case.
could any one tell me that if this script is good enough and working , and also I thought in some places I need to quite the program but I dont know how to quite in Unix...
foreach file (*.cpp *.h) // loop for .cpp & .h file
if (-d $file )then // if the file is directory
echo 'Warning: $file is Directory' // print warning message
elseif (-f $file) then // else if it is file
set var=$file // set file to variable
// convert name of variable into lowercase and then give its value to newvar
set varnew=`echo var | sed 'y/ABCDEFGHIJKLMNOPQRSTUVW
if ($var==$varnew) then // compare the name when converted to lower case and the name at the beggining
echo '$file: file name aready in lower case!' // if same prints warning
// quite from the program
endif // end if
if (-e $varnew) then // check if any file with same name in lowercase exists
echo '$file = with lower case in exist, cant convert to lower case' // print warning
//quite
endif
mv $file $varnew // move value of varnew to file (change its name??)
endif
end
This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership