![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 12:31 PM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 12:06 AM |
| here document to automate perl script that call script | hogger84 | Shell Programming and Scripting | 3 | 10-22-2007 07:15 AM |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 04:05 AM |
| return valuse from child script to parent script | borncrazy | Shell Programming and Scripting | 1 | 08-20-2004 12:39 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
script
I'm trying to learn unix and was going through some problems when I ran into this questiona about creating a script that will caclulae the suam and average of the scores for the assignments and quizzes after it drops the worst one. this tool will manage the data with each own weight and generate a final grade in the letter format. Also provide the option to send the grade report to user by email. an if then else fi command is expected in the script, same as case in esac and for while loop. Unix `trap` function shall be included to demo how it uses it.
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
And what's ur question?
|
|
#3
|
|||
|
|||
|
stuck
Im not to sure where I'm even supposed to begin with this program. I am a first time user. trying to try to prorams that I'm trying to understand
|
|
#4
|
||||
|
||||
|
Sounds like a homework question...
Take the program in pieces. Start simple |
|
#5
|
|||
|
|||
|
I'm going through a unix book that I bought. But I wanted to know if it was possible to see an example to see it I understand it but I have no clue to where to begin
|
|
#6
|
|||
|
|||
|
The best thing to start a script is to tell the shell in which shell the script has to run
#!/usr/bin/bash and then... |
|
#7
|
|||
|
|||
|
i have that so far this is what i have
#!/usr/bin/ksh # #export PATH=/bin:/usr/bin # #shell variables PROG=`basename $0` # #OutFile=/tmp/$LOGNAME.$PROG # #echo "Hi $LOGNAME:\n\tPlease enter scores of assignments (seperate by 'space'): \c" read input echo # Counter=0 Total=0 Worst=999 cp/dev/null $OutFile # for score in $Input do # case "$score" in [0-9]|[1-9][0-9]|100) Counter=`expr $Counter +1` [$score -it$worst] && Worst=$score Total=`expr $Total + $score` echo "\tHw-${Counter}: ${score}, Sum: ${Total}, Worst One: $Worst" | tee-a $OutFile ;; [0-9]|[1-9][0-9]|100) echo "\tYou enter <$score> which is greater than 100 ==> no! no!!" >&2 exit 10 ;; *) echo "\tYou enter <$score> which is not a positve number">&2 exit 20 ;; esac done # echo" $Counter Assignments Total: ${Total}, Worst: $Worst" | tee-a $OutFile Conter=`expr $Counter -1` Total=`expr $Total - $Worst` Average=`expr $Total/$Counter` echo" Average is $Average" | tee-a $OutFile # echo "Enter the email id to receive tis report: \c" read Rcptld if [-n "Rcptld"]; then mailx-s "CMP-322 Reportcard" $Rcptld <$OutFile fi # exit 0 but Im still missing the if-then-else-fi command, a case-in-esac, and for/while loop, a trap function, and also a function to check input. And that's what I don't know how to do. |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|