|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Shell Script help.. please some one help me...
can someone please please please help me with this folowing question. I finished all my other question. but this question i dont know..doesnt work. can you please help me.
THANK YOU SO SO SO MUCH. 1. write a shell script called "days" to calcualte the number of intervening days between two given dates. Invoke the script as follows: $days date1 [ date2 ] where date1 and date2 have the format: mm/dd/yyyy (month, day, year). If the date2 is not specified, use the current date as a default. use the following definition of a leap year: a year is a leap year if it is divisible by 4 but not by 100, except that years divisible by 400 ARE leap years. Run the script with the following dates: 01/01/2001 - default 01/01/1900 - 01/01/2000 01/02/1492 - 08/11/1950 04/04/1853 - 04/04/2000 01/30/1703 - 12/31/1899 2. Write a shell scrpt called "rename" that renames gven list of files into target files. any upper case characters of given file name are to translated into low case characters of target file name. all other characters of given file name remain unchanged. effectively the corresponding target file name contains only low case characters plus any other characters from given file name. FOr example, $ renamed aBcD NN9x.2 renames file aBcD into abcd and file NN9x.02 into nn9x.z The folloiwing specifications are to be used: #NAME # rename - rename file from upper case into low case chars ( if any) . # SYNOPSIS # /usr/bin/renamed [-iv] file [file] [file] ... #descrption: # change file names from upper to low case characters all other characters remain nchanged. #option: # -v verbose will display file names been processed. # -i the script will prompt for confirmation whenever the move would overwerite an existing target file: # "y" (YES" answer means that the move should processed # "a" (ALL) answer means that the move shold processed for this file and for the REST of files WITHOUT PROMPTING. # "n" (NO) anwer means that the move should not processed. # "q" (QUIT) answrs stops executiion of the script. # any other answers prevents move from overwriting the target file. P.S: One application for using rename is to renamed files, that were ftped from Pc to UNIX, it is common practice that PCs file names are in upper case characters. |
|
#2
|
|||
|
|||
|
For date operations, there are a lot of choices. See:
http://www.unix.com/showthread.php?s=&threadid=13785 FWIW, if this is a lower level course, the prof may have made a mistake in that date operations in pure shell script is not straightforward. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Shell Script help.. please some one help me... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|