Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Unix c shell script
Name: wind0610 Date: January 15, 2006 at 09:15:58 Pacific OS: WindowsXP CPU/Ram: 1gb
Comment:
I need to write a script that can check if the file exists ignore the case. How can I do that? Please help me out!! Thank you all.
Name: aka Date: January 15, 2006 at 12:04:47 Pacific
Reply:
Something like this ?
If not, please be more specific. :D
clear echo -n "Search file if exist for : " read chfile ls -lG $chfile ls -lG /home/$chfile
Don“t freak out until you know the facts...Relax...!
0
Response Number 2
Name: wind0610 Date: January 15, 2006 at 12:15:41 Pacific
Reply:
Here is what I need to do. First, I want to find all the .cpp and .h files then check if the file is not directory, not already in lower case, and no other files has the same name. If it passes those tests then rename the file into lower case. Here is my script #!/bin/csh foreach file (*.cpp *.h) if (-d "$file") then echo 'Error: This is a directory that cannot be renamed.' else if(#don't know what to do) then echo 'Error: The file name is already in lower case.' else if(#don't know what to do) then echo 'Error: The file already exists.' else echo "$file" | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' >> newname mv $file $newname echo "The file $file has been renamed to $newname" endif end
0
Response Number 3
Name: wind0610 Date: January 15, 2006 at 19:03:08 Pacific
Reply:
Never mind ~I get this fixed Thank you for the help.
Summary: Hi, I am very new to Unix (taken one week of class so far) and have been given an assignment that I find impossible to accomplish. It seems like a very advanced assignment. The assignment is as fo...
Summary: I have following requirements in C shell script: - The script accepts the date input - Upon accepting the date, the script needs to list all the files greater than date inputted Also, someone thr...
Summary: I am tring to write a c shell script that will take input of a number between 1 - 24 check to make sure the entered # is in range then convert it to seconds for use by the sleep command. the script wo...