Sunday, September 30, 2007

OPS435 W4L2

OPS435

Chinese year doesn’t start on January 1, calendar based on the lunar, ours on the solar, instead of making it difficult u can assume January 1st to December 31st, each year has an animal assigned to the year, that’s number two, the year they enter the proper animal number three you gotta tell the user what day of the week their born in number four how many days in the 21st century they have seen it starts January 1st 2001, they can give you it two ways

Age.bash and give you the birthday
They can also give you without a document,
Age.bash
The very first thing in your assignment is to find out the user entered data in the command line or not, if they didn’t enter data on the command, then you ask the user for the data, so you the data form the command line ro from the keyboard, depending on what, you must check it first, the messages on the script should be a standard error not a standard output, number 2 is, because no loops you don’t have to put it in a loop, stage 2 has to be in a loop, you must stay in the loop till the data is correct then you can come out in the loop and take the data, but stage 1 no loop, see if the data entered is eight chars long, if its not display message on sheet, check if they gave you a valid date, compare it with the cal command, check if its not a future date, and if it is you tell em what they entered.


The rest of it!

Calculate years and age in full months in instance if one of you

September 19 1990, today he is sixteen , must be a full year before your 17, same thing happens with months that’s why you must figure out months, for instance if you go from may 12 jun 12 full month, may 12 june 11 not a full month, that’s what he means by full months

No exit or clear command in the program, do not use the –p option with the read command,

Read –p message variable, what he is saying don’t use the –p option with the read command in this project, an example of what he wants exactly on the screen.

A couple of other things about the assignment, comments through out,


Another command we might use,
When you do calculations (()) heres a warning when you use the (()) not only does arthimetic expression, also checks to see if ur doing decimal or octal, if it does the octal will do octal calucations or decimal, the moment it sees a number with a zero its an octal number 07 + 09 u will get an error, octal 0-7 deciam l 0-9, the numbers ur using cannot start with a zero that way it sees its decimal so it will do decimal calculation.

Another command to do this (calculations)

Expr only does decimals if you say 7 + 09

Expr 7 + 09
With this command u must have it exactly the way it should be, lets say you want to multiply contents of variable A by 20 $a + 20 that will fail , + is a special char and go into correct directory and replace it with all the names, how do you prevent the shell from interpreting this you put a \ in front and it will work, and all the other operators apply to this command as well, this command does a lot as well, but only the arithmetic part of this command.

Cal 02 1971 | grep

Cal 02 1971 | grep –w 2

Test command checks things, coming week lots of stuff on

Conditional parameters

Date +%S time frame

The moment you hit the key board

January 1st 2001 until today

Cal –j how many days

Today is 2007 09 28

Lets say we have 2000 10 29

No comments: