SunQuest
           UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 30th, 2004, 09:32 AM
Hidden_Secrets Hidden_Secrets is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 6 Hidden_Secrets User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old July 30th, 2004, 09:45 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Shell Script help.. please some one help me...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway