Sponsored Content
Top Forums UNIX for Dummies Questions & Answers shell scripting project for school Post 302573219 by bodhi 926 on Sunday 13th of November 2011 04:59:41 PM
Old 11-13-2011
shell scripting project for school

i need to prompt the user for


a) group of scores
b) calculate the lowest and highest scores and overall average
c) print out to the screen
d ask if user has any more data to process, if so repeat (loop) for a new set of scores if not exit.


i have this much,and trust me i know there is a lot missing



#!/bin/bash


echo
echo -n "Enter the first score (abc to exit): "
read $score


until [[ $first == abc ]]
do
echo -n "Enter the next score: "
read $score







until
echo -n "Enter d if all scores are entered: "
read $score

[[ $score == $score+1 ]]







echo "The result is: $ans"



done


echo "Goodbye"
echo
exit 0






I know I am on the right track, but Unix is new to me (school project) I am just looking for help, ive been around since the dos days and have played some with vb, basic, etc. but its been awhile, any help is appreciated (its due Wednesday!!)

---------- Post updated at 01:59 PM ---------- Previous update was at 01:23 PM ----------

#THIS IS WHAT I HAVE SO FAR, WILL KEEP WORKING


#!/bin/bash

echo
echo -n "Enter the first score (abc to exit): "
read $score

until [[ $first == abc ]]
do
echo -n "Enter the next score: "
read $score




until
echo -n "Enter d if all scores are entered: "
read $score


if [[ $oper == d ]]
then
#this would be the sum of scores
(( $ans == $score + 1 ))
(( $ans == $score + $score + 1 ))

then
#this would be the avg of scores
(( $ans == $score / ?))

then (( $hilo == $score < >))
#this would be highest and lowest

then (( $avg == ))



fi


#print out

echo "The sum is: $ans $hilo $avg"
echo "The High Low scores are $hilo"
echo "The average score is $avg"

echo -n "Do you want to input a new batch of scores? (abc to exit): "
read $score

if [[ $oper == d ]]
then

else
fi
done



echo "Goodbye"
echo
exit 0
 

3 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

shell scripting project for school

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: i need to prompt the user for a) group of scores b) calculate the lowest and highest scores and... (1 Reply)
Discussion started by: bodhi 926
1 Replies

2. Shell Programming and Scripting

Suggestions for Shell Scripting Project

I'm taking a class right now and need ideas for a project. The scope is relatively vague: "Create a 'mash-up' program that combines system administration functions into a single application." I would say my skills working in bash are between average and slightly above average. I was originally... (2 Replies)
Discussion started by: d3mon_spawn
2 Replies

3. Shell Programming and Scripting

Beginner Scripting for school

Hello people, I am new to the forum and to scripting and I'm honored to be a part of the Forum :) At the moment I'm learning to do basic scripting for school. Now I got 2 assignments that I do not understand. The case scripting I have mastered a bit. But now I have an assingment to make with... (1 Reply)
Discussion started by: hulsi88
1 Replies
TETRIS(6)							 BSD Games Manual							 TETRIS(6)

NAME
tetris -- the game of tetris SYNOPSIS
tetris [-ps] [-k keys] [-l level] DESCRIPTION
The tetris command runs display-based game which must be played on a CRT terminal. The object is to fit the shapes together forming complete rows, which then vanish. When the shapes fill up to the top, the game ends. You can optionally select a level of play, or custom-select control keys. The default level of play is 2. The default control keys are as follows: j move left k rotate 1/4 turn counterclockwise l move right <space> drop p pause q quit The options are as follows: -k The default control keys can be changed using the -k option. The keys argument must have the six keys in order, and, remember to quote any space or tab characters from the shell. For example: tetris -l 2 -k 'jkl pq' will play the default games, i.e. level 2 and with the default control keys. The current key settings are displayed at the bottom of the screen during play. -l Select a level of play. -s Display the top scores. -p Switch on previewing of the shape that will appear next. PLAY
At the start of the game, a shape will appear at the top of the screen, falling one square at a time. The speed at which it falls is deter- mined directly by the level: if you select level 2, the blocks will fall twice per second; at level 9, they fall 9 times per second. (As the game goes on, things speed up, no matter what your initial selection.) When this shape ``touches down'' on the bottom of the field, another will appear at the top. You can move shapes to the left or right, rotate them counterclockwise, or drop them to the bottom by pressing the appropriate keys. As you fit them together, completed horizontal rows vanish, and any blocks above fall down to fill in. When the blocks stack up to the top of the screen, the game is over. SCORING
You get one point for every block you fit into the stack, and one point for every space a block falls when you hit the drop key. (Dropping the blocks is therefore a good way to increase your score.) Your total score is the product of the level of play and your accumulated points -- 200 points on level 3 gives you a score of 600. Each player gets at most one entry on any level, for a total of nine scores in the high scores file. Players who no longer have accounts are limited to one score. Also, scores over 5 years old are expired. The exception to these conditions is that the highest score on a given level is always kept, so that following generations can pay homage to those who have wasted serious amounts of time. The score list is produced at the end of the game. The printout includes each player's overall ranking, name, score, and how many points were scored on what level. Scores which are the highest on a given level are marked with asterisks ``*''. FILES
/var/games/bsdgames/tetris-bsd.scores high score file BUGS
The higher levels are unplayable without a fast terminal connection. AUTHORS
Adapted from a 1989 International Obfuscated C Code Contest winner by Chris Torek and Darren F. Provine. Manual adapted from the original entry written by Nancy L. Tinkham and Darren F. Provine. Code for previewing next shape added by Hubert Feyrer in 1999. BSD
May 31, 1993 BSD
All times are GMT -4. The time now is 02:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy