Create a bash shell script for a number guessing game. Here are the requirements: a. Your program generates a random number between 0 and 128 and keeps asking the user to guess the number until the user guesses it correctly. b. If the user guesses a number that is lower or higher than the number to be guessed then indicate that information to the user as a ‘low guess’ or a ‘high guess’ so that the user can get to the correct guess quicker. c. The program keeps track on number of guesses taken by the user to get to the correct guess. This is user’s score. d. Your program asks user for the name and adds user’s name and the score in a file that keeps track of the scores by various users. e. At the end of the game, the program displays the top 3 scores (lowest 3 scores) along with the name of the users to conclude the game. John 4 Sam 7 Tony 10

Answers

Answer 1

Answer:

Here is the bash shell script:

scorefile="scores_bash"

guess=-1

typeset -i n=0

echo -e "guess.bash - Guess a number between 0 to 128\n"

(( answer = RANDOM % 128 + 0 ))

while (( guess != answer )); do

n=n+1

read -p "Enter guess $n: " guess

if (( guess < answer )); then

 echo "Low guesss"

elif (( guess > answer )); then

 echo "High guess"

fi

done

echo -e "You guessed the number in $n guesses.\n"

read -p "Enter your name: " name

echo $n $name >> $scorefile

echo -e "\nScores"  

sort -n $scorefile

Explanation:

The program creates a scorefile as scores_bash to store the names and scores. Next the program initializes the guess with -1. guess is used to store the guess made by user and n is used to store the number of trials user took to guess the correct number. Next the program prompts the user to: Guess a number between 0 to 128 and generates random numbers from 0 to 128 and store it into answer.  Next the while loop keeps repeating until the user guesses the correct number. If the user guess is less than the correct answer then the program displays the message Low guess otherwise displays High guess. When the user guesses the correct number, the loop breaks and the message You guessed the number in $n guesses. is displayed where in place of $n the number of trials user take to guess the number is displayed. Next the user is asked to enter his name.

echo $n $name >> $scorefile statement adds the n which is the user score and name which is the names of user to the score file.  sort -n $scorefile  sorts the file in ascending order to display the lowest  scores. The screenshot of program with its output is attached.

Create A Bash Shell Script For A Number Guessing Game. Here Are The Requirements: A. Your Program Generates

Related Questions

what are the software is there ? their uses

Answers

Answer:

Computer software is programming code executed on a computer processor. The code can be machine-level code, or code written for an operating system. An operating system is software intended to provide a predictable and dependable layer for other programmers to build other software on, which are known as applications.

I’m sorry but I don’t think you worded that correctly

8. It is a computer component that converts AC power to DC power to be used
by the computer system.

Answers

Answer:

power supply unit.

A power supply unit (PSU) converts mains AC to low-voltage regulated DC power for the internal components of a computer. Modern personal computers universally use switched-mode power supplies.

Explanation:

I HOPE THIS HELPS

PLZ MARK ME AS BRAINLIEST

THANK U!

________ were developed to allow computers to communicate using networking standards.
A. Nodes B. Sound cards C. network interface cards
A ______ is an interconnection of computers sharing data and peripherals.
A. Node B. Network C. peripheral
A ______ is any computer or digital device (wired or wireless) using the network to exchange data between other computers.
A. Nodes B. Network C. Analog
Walking the data to someone else is called ______.
A. Network B Sneaker-Net C. peripherals
_______ transformed computing by they providing fast, easy access to messages or data and to other users.
A. Digitals B. Peripherals C. Networks

Answers

1.) Network interface cards

2.) Network

3.) Nodes

4.) Sneaker-net

5.) Networks

Answer: Trust the person up top

Explanation:

Your school is hosting a diving contest, and they need a programmer to work on the scoreboard! Your job is to calculate each diver's total after the three judges hold up their individual scores. Write the function calculate_score which takes a tuple of three numbers from 0 to 10 and calculates the sum. A perfect dive is worth 30 points, a belly flop is worth 0. For example: calculate_score((10, 10, 10)) # => 30 calculate_score((9, 9, 6)) # => 24

Answers

Answer:

def calculate_score(setss):

    num1, num2, num3= setss

    if num1 >= 0 and num1 <=10 and num2>= 0 and num2<=10 and num3>= 0 and num3<=10:

         print(num1+ num2+num3)

    else:

         print("Out of range")

Explanation:

I've added the full source code as an attachment, where I used comments as explanation

As the senior analyst responsible for data staging, you are responsible for the design of the data staging area. If your data warehouse gets input from several legacy systems on multiple platforms, and also regular feeds from two external sources, how will you organize your data staging area? Describe the data repositories you will have for data staging.

Answers

Answer:

The corresponding schemas I use such as given below.

Explanation:

Dim: Used in the design for certain artifacts belonging to measurements. Fact: Used for these artifacts throughout the design relevant to the truth Admin: Used for all configuration-related artifacts that could be open to professional end-users. Audit: That used to hold audit-related particles. Etl: Is used for keeping objects, particularly staging details, directly connected to something like the ETL method. Report: Used to keep objects utilized explicitly for programs for documentation.Olap: Used for keeping objects directly used for systems for study. Test: Used to carry objects which have been used exclusively for research. Useful- Used to carry objects that just about any member including its implementation may typically use.

Changing the position of the wing will

Answers

Answer:

will cause error in your pc many many many

Answer:

change the center of gravity and neutral point

Explanation:

What is a row of data in a database called?
Field
File
Record
Title

Answers

Answer:

record

Explanation:

i took the test and got it right but give brainliest to the person above me

five reasons Why Photographers Aren't Filmmakers

Answers

Answer:

1. They don't like recording things (They'd rather take photos)

2. It doesn't take much time to take a good photo as it is to record a video

3. They'd rather work alone or with others who want pictures taken

Explanation:

These are weird reasons but true..I'm a photographer so these are my reasons. I don't have others tho. Sorry.

Meet my horse! ask questions about him too!

Answers

Answer:

no answer, just horse

Explanation:

how much does he eat and is his hair soft? jdnfnnan

Answer:

Hi I have a horse too. He is so handsome

what dicapline do you do?

Explanation:

What is one step taken when solving a computer software problem?

Answers

scanning the computer and deleting any viruses

[ if this helped you please give brainliest :) ]

Answer:

B. scanning the computer and deleting any viruses

Explanation:

edge 2020

Which statement best illustrates the relationship between three different
elements of the circular flow of products?
O A. Households pay wages to businesses, which can then set up
product markets.
O B. Product markets offer labor to businesses, which creates jobs for
households.
O C. Businesses create goods for product markets, which sell them
directly to households.
O D. Resource markets sell goods to product markets, which sell the
goods to businesses

Answers

Answer:

C

Explanation:

GDP can be represented by the circular flow diagram as a flow of income going in one direction and expenditures on goods, services, and resources going in the opposite direction. In this diagram, households buy goods and services from businesses and businesses buy resources from households.

My notifications keep glitching and saying i got messages
But they dry

Answers

Answer: just reset the phone

Explanation: if it keeps doing that then you have some app that's not supposed to be there

When determining the cost of an item, the seller will often analyze the demand as well as the supply before setting the price of the blank
.

Answers

Answer:

The price of a commodity is determined by supply and demand. therefore the answer is COMMODITY. that other person is wrong

Answer:  The correct answer is Commodity

Explanation:  This answer is confirmed correct.

Commodity pricing is established based on supply and demand.

Type the correct answer in the box. Spell all words correctly.
How is it possible to access data from any location?
Storing data on the _________ enables access from any location.

Answers

Answer:

Storing data on the cloud enables access from any location.

Explanation:

Answer:

the answer is cloud becus i get it right

Explanation:

Use the drop-down menu to complete the steps for using the Autofill feature. Click the . Click the . Drag the to the desired range. Click the Autofill option you want to use.

Answers

Answer:

Cell,fill handle,fill handle

Explanation:

Trust

Answer:

Guy up top is correct, it's Cell, Fill handle, Fill handle, in that order

Explanation:

Which below best describes JavaScript? *
a) a common dynamic computer language
b) C++ with a different name
c) The study of coding

Please help me out! 23 extra points!

Answers

Answer:

it is a programing languwage that is useualy used to program visual or text based applications

Explanation:

Answer: A

JavaScript is a common dynamic computer language. It was invented decades ago.

C++ is a different way of coding, it is not the answer. Many different people use C++, because they prefer it is easier than JavaScript.

Hope this helps!

Name the application pagram used in creating the
document above​

Answers

Answer:

Excel or Google Sheets

Explanation:

Which of the following are likely reasons people enjoy watching lifelike stories on the screen? Select all that apply.


People develop a connection that is emotional with the stories and/or characters.

The stories remind them of situations they are familiar with.

The situations they see are not familiar to them.

They are distracted by the video and sound combination.

Answers

Answer:

c

Explanation:

I dont know but omost every time I guess I get it right

Answer:

A: People develop a connection that is emotional with the stories and/or characters.

and

D:The stories remind them of situations they are familiar with.

Explanation:

edg2021

An instrument used to measure the amount of electrical current intensity in a circuit

Answers

the instrument is an ammeter

Use the drop-down menus to complete the steps for using the Scenario command.


1. Select the cells you want to use in your scenario.


2. Go to the ____ tab.

Data
Home
Insert
Formulas

3. In the Forecast group, select _____ and click Scenario Manager.

Sort
Get Data
Forecast Sheet
What-If Analysis

4. Click Add and fill in the name and add comments if you wish.


5. To compare, you will want to create _____ version.

A what-If
A original
A Data Table

6. Add a second scenario, changing the values from the first.


7. Click _____ to view the values in each scenario.

OK
Show
Review

Answers

Answer:

1. Select the cells you want to use in your scenario.

2. Go to the Data tab.

3. In the Forecast group, select What-if Analysis and click Scenario Manager.

4. Click Add and fill in the name and add comments if you wish.

5. To compare, you will want to create an original version.

6. Add a second scenario, changing the values from the first.

7. Click show to view the values in each scenario.

I got the answer right on Edge :)

The cells a person want to use are:

Go to the Data tab. In the Forecast group, select What-if Analysis and click Scenario Manager.Click Add and fill in the name and add comments if you wish. To compare, you will want to create an original version.

What is cell?

A cell is known to be area that is found on a spreadsheet that is known to be the place where the data are said to be entered.

Note that in the case above, The cells a person want to use are:

Go to the Data tab. In the Forecast group, select What-if Analysis and click Scenario Manager.Click Add and fill in the name and add comments if you wish. To compare, you will want to create an original version

Learn more about cells from

https://brainly.com/question/13920046

#SPJ9

Reflect on the questions below.

1.) Why do some people resist help from others?

2.) Is it useful to work separately at some point in time during pair programming?

3.) How is pair programming beneficial?

4.) In pair programming, how can we better work together?

Answers

Answer:

Why do some people resist help from others? Because they fear that their ideas might be rejected.

Is it useful to work separately at some point in time during pair programming? Yes, it is helpful because one can do coding while the other one is navigating or doing something else, it allows the pair to work faster and more efficient.

How is pair programming beneficial? It is beneficial because you can cover more stuff with the help of other people that what you would cover by yourself.

In pair programming, how can we better work together? By communicating with each other, discovering our strengths and working on our weaknesses. 

Explanation:

Why does a bus topology require a terminator

Answers

Answer:The purpose of the terminator is to absorb signals so that they do not reflect back down the line

Explanation:

The answer is-

B.) because otherwise the packets will bounce back and forth from end to end repeatedly

Bus topology can be regarded as a kind of topology for a Local Area Network, it is one that has it's nodes connected to a single cable(backbone) and any break in the so called backbone, there will be failure in the entire segment. However a Terminator is usually attached to the end-points of a bus network so that the signal is absorbed by the Terminator and as a result of this the signal will not reflect back down the line. If there is no Terminator there would be bouncing back and forth of packet in an endless loop.It should be noted that a bus topology require a terminator because otherwise the packets will bounce back and forth from end to end repeatedly

What is the purpose of this diamond shape in a flowchart?

Answers

Answer:

To represent a decision making step.

Explanation:

for example, assume that you need to display 'pass' if the total marks are greater than 50 and 'fail' if it's less than 50

Then, after calculating the total, you should draw a diamond and inside it write, 'is total ∠ 50?'

after that you can continue your flowchart taking one decission as 'yes' and the other decission as 'no'

The rectangular shape stands for a task or course of activity. In the flowchart sequence, the diamond shape represents a question or a branch.

What is flowchart?

A flowchart is a diagram that shows a process' individual steps in their proper order.

It is a general tool that may be customised for a wide range of uses and used to define a variety of processes, including a project plan, an administrative or service process, or a manufacturing process.

These four typical forms are excellent for outlining organisational structure, how various departments interact, and economic, industrial, or administrative operations.

In a process, a decision point is represented by a diamond. Usually, the statement in the symbol will call for a "yes" or "no" response and, in accordance, branch to other locations in the flowchart.

Thus, this is the main use of diamond symbol in a flowchart.

For more details regarding a flowchart, visit:

https://brainly.com/question/14598590

#SPJ2

Find the value of 1/2 of 1/2​

Answers

Answer:

1/2 of 1/2​ is 1/4 or 0.25

Explanation:

Answer:

0.25 or 1/4

Explanation:

because 0.50 is 1/2 so half of 0.50 is 0.25 or 1/4

What is the output?
password = "sdf# 356"
>>> password. isalnum()

Answers

The output is False because the string password contains #.

Answer:

The answer is False.

Explanation:

The answer is false becasue it has other characters than letters and numbers.

Have a great day, I hope this helped.

Which of the following behaviors is considered ethical?

A. copying another user’s password without permission
B. hacking software to test and improve its efficiency
C. using a limited access public computer to watch movies
D. deleting other user’s files from a public computer

Answers

Answer:

answer is c. using a limited access public computer to watch movies

Answer:

using a limited access public computer to watch movies

Explanation:

It is the only one that will not get you in big trouble

If String str = "United States";, then what is the value of str.indexOf("united");?

−1
0
1
2
3

Answers

Answer:

-1

Explanation:

due to the fact their is no capital "U" it will -1

Dan works for an automobile company. He has designed a new model of a car based on an older version. Which technology can he use to present the model at a board meeting?
A.
wearable computing
B.
3-D printing
C.
grid computing
D.
screenless display

Answers

Answer:

a

Explanation:

i did the test

Answer:

The answer is B (3-D printing)

Explanation:

Which is the civil penalty for COPYRIGHTS violations? Choose the answer. $200-$150,000 fine up to five years in jail Fines and court costs 1 year in jail

Answers

Answer: $200-$150,000 fine

Explanation:

I took the Quiz

Select the correct answer.

What is the drawback of the linear model?

A. communication is only in one direction

B. too much noise is created

C. no feedback is sent on receiving the message

D. long travel between the sender and the receiver

I NEED this asap
20 points

Answers

long travel between the sender and the receiver

Answer:

D. long travel between the sender and the receiver

Explanation:

Other Questions
In a powder-flavored drink solution, which substance is the solvent?a. glassb. flavored powderc. waterd. sugar Does anyone know how to do graphing stories? I need help I dont understand my teacher and I have to find the slope of those pls answer ASAPJamal is making a graph to relate the number of hours he studied to the number of points he scores on his math tests. The relationship is proportional. What should a graph of this information look like?A.) a line that is straight up and downB.) a line curves upward but then curves back downC.) a straight line that passes through the point (0, 0)D.) a line that starts at the point (0, 0) and then curves upward Explain what would happen to every delegate that signed the Declaration of Independence if the colonies lost the war against England What did Douglass and his descendants identify that demonstrates those ideals were not fulfilled? Relate the buoyant force to increased depth Plzzzzzz due very soon i willl mrk barainliest!!!!!!!Read the following excerpt from Poes Cask of Amontillado and answer the question.The wine sparkled in his eyes and the bells jingled. My own fancy grew warm with the Medoc. We had passed through walls of piled bones, with casks and puncheons intermingling, into the inmost recesses of the catacombs. I paused again, and this time I made bold to seize Fortunato by an arm above the elbow.Which of the following words from the passage above connote a sense of dread?Select all that apply.seizewarminmostbonesjingled Share one or two specific examples of how you will use the concepts or strategies presented in this class to contribute to your academic and career success. Which of the following are sources of low-level radiation?A)medical X-raysB)nuclear weapons testingC)buring of fossil fuelsD)all of the aboveE)a and c only Helpppppp What is telnet?internet protocol that allows one to access newsgroupsinternet protocol that is the foundation for online data communicationinternet protocol that connects to a computer remotelyinternet protocol that loads a local file from a network onto a computer Find the mean (do not round )38,18.05,25,26,46 72(x11)=8 i am having trouble Si el tamao de una bacteria es 1,59 x 10-3 mm, cuntos tomos de oxgeno caben a lo largo de ella? (Sabiendo que: el ancho de un tomo de oxgeno aprox. Es 4,804 x 10-9 cm). the phosphate groups are the polar part of the phospholipid because they are: Victoria has $30 to spend at the fair. Admission cost $7. Ride tickets cost $0.75 each.Write and solve an inequality that represents the number of ride tickets, she can purchase.(5 points) Why does ice float on water?A.The temperature of ice is lower than the temperature of water.B.The temperature of water and ice are the same.C.The density of Ice is less than the density of water.The density of ice is greater than the density of water.D.ResetNext . Why did the British call the Second Continental Congress a den of traitors? How would you describe Rikki-tikki? Select all that apply.*shy*curious*friendly*lazy*restless Irony means :A)Tunnel visionB)Probable causeC)Caustic remark D)Clean slate