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

During active listening, which response is NOT an example of providing feedback to the speaker to show that you understand his or her thoughts?
A.
nodding your head
B.
turning your back to the speaker
C.
saying, "You're saying that his reaction made you feel appreciated?"
D.
saying, "Sorry to interrupt, but can you explain that part again?"

Answers

Answer:

The answer is D.

Explanation:

They/you are asking the speaker to clarify what they just said.

Answer:

B. turning your back to the speaker

Explanation:

Which is the best description of the laws governing IT professionals?

Answers

Answer: D, Most laws are directed at the information, data, or intellectual property rather than the IT professional.

Explanation:i just took the test

The item in this illustration that is highlighted is _____.



help
the status bar
zoom control
the title bar

Answers

Answer:the title bar

Explanation:

Answer:

I think it's title bar

Explanation:

I'm not positive but another guy said it and its the only one that makes sense

Do the binary numbers 001101 and 00001101 have the same value or different values

Answers

Answer:

Yes, the both have the same value.

Explanation:

This is the answer because:

001101 = 13

00001101 = 13

Hope this helps! :D

Can a computer evaluate an expression to something between true and false? Can you write an expression to deal with a "maybe" answer?

Answers

Answer:

yes it can

Explanation:

Computers cannot evaluate an expression to be between true or false.

Expressions in computers are represented in boolean values; i.e. they can only take one of two values (either true or false, yes or no, 1 or 0, etc.)

Take for instance, the following expressions will be evaluated to true, because the expressions are true.

[tex]\mathbf{1 + 2 = 3}[/tex].[tex]\mathbf{5>4}[/tex].[tex]\mathbf{4 + 4 <10}[/tex]

The following expressions will be evaluated to false, because the expressions are false.

[tex]\mathbf{1 + 2 > 3}[/tex].[tex]\mathbf{5=4}[/tex].[tex]\mathbf{4 + 4 >10}[/tex]

The above highlights show that, a computer cannot evaluate expressions to another value other than true or false

Read more about computer expressions at:

https://brainly.com/question/17500565

What type of data is the result of each of the following lines of code?
str(2.34)

int('2')

float(2)

Answers

Answer:

snag

Explanation:

Which tab is used to configure an export to PST in Outlook 2016?
Send/Receive
File
Home
Review

Answers

Answer:

File Tab

On the topmost ribbon of MS Outlook, go to the File Tab. Click Options>Advanced>Export. From Import and Export wizard, select Export to a file.

The file tab in Outlook 2016 will be used to configure an export to PST. Then, choice B is the best one.

What is outlook?

On your PC, Outlook Desktop App is already installed. You can access it from the Taskbar or the Start menu on your computer (bottom panel of your screen). By logging into your email account using a web browser that you can use Outlook on the web.

By selecting the "Files" icon in Outlook's lower-left corner, you can reach this view. It will be situated between the "People" and "To-Do" icons by default. If you cannot see it but instead have a three-dot icon, click it and then select "Files" from the menu that appears.

The tab used to configure an export to PST in Outlook 2016 will be known as the file tab. Then the correct option is B.

More about the outlook link is given below.

https://brainly.com/question/17457799

#SPJ6

A student opens a recently purchased software package and begins reading the enclosed materials. What information might be included in the software license? Check all that apply.

Answers

Answer:

1,2,4

Explanation:

plss give me brainliest

Answer:1,3,4

Explanation:just did it

Helpppppp What is telnet?
internet protocol that allows one to access newsgroups
internet protocol that is the foundation for online data communication
internet protocol that connects to a computer remotely
internet protocol that loads a local file from a network onto a computer

Answers

C. internet protocol that connects to a computer remotely

Can a syntax error occur in a block-based code? Why or why not?

Answers

The environment stops two instructions from snapping together if they cannot be combined to form a valid assertion. Via preventing syntax problems in this way, block-based programming environments maintain the practice of writing programs by piecemeal assembly of statements.

Why do syntax errors happen?

When a programmer enters an incorrect line of code, they have made a syntax error. Missing punctuation or misspelled names are the two most common syntax mistakes. In either a compiled or an interpreted programming language, a syntax error prevents the code from running.

The source code contains a syntax error, but the object code does not. A source program is created by a programmer using a word processor or editor and written in high level language.

To learn more about Syntax error refer to:

https://brainly.com/question/24822807

#SPJ1

true or false Output is a tool with a power system that takes advantage of certain scientific laws that make the tool work better

Answers

Answer: True

Explanation: While digital evidence exploitation is a relatively new tool for law investigation when digital evidence is limited or does not exist. Do with the disappearance and death; searches found some mies; in fact, he was well-liked and often left his home open could take particular advantage, given the more limited poten.

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 are some internet hardware components? What is used to make the internet work?

Answers

Answer:

Internet Connection Components and Functions

DSL Modem–

DSL/Broadband Filter.

Firewall and NAT Router.

Computer Firewalls –

ICS (Internet Connection Sharing)-

Network Hub.

Network Switch.

Wireless Access Point.

The
is an interest inventory that classifies people according to six different types: Realistic, Investigative, Artistic, Social, Enterprising, and Conventional.


is an aptitude assessment that matches students with study programs at specific colleges and universities.

Answers

Answer:

Campbell Interest Inventory , FOCUS2

Explanation:

Answer:

Campbell Interest Inventory , FOCUS2

Explanation: I took the test and made 100

I need to identify what this building is

Answers

Answer:

its American building name annismous building


2 A_______
uses graphics or pictures to help the user navigate and
access programs

Answers

Answer:

the interface

Explanation:

what is a document you can create with word processing software________?

Answers

Answer:

I think like Microsoft Word, Google Docs/Slides, or maybe other Microsoft writing services.

Explanation:

hope this helps!

In one to two sentences, describe how to create a new tab.

Answers

Answer:

First you could move your cursor to the right and click on the button that looks like this +    

Or you can press ctrl+T and make a new tab

Explanation:

Hope this help you!

I don't even understand what I'm supposed to do.

Assignment/ Question
Alex is the new office manager at a small advertising firm. One responsibility is to manage the technology being used by the employees. However, it turns out that they have been using outdated software and could use some upgrades! Before launching a campaign to modernize the office software, Alex needs to know exactly what kinds of software to recommend, so a survey will be distributed to find out what common file types the employees use. Please help by explaining what a file type is, what the different kinds are, and what each one does best. Write a paragraph of at least five sentences that Alex can include at the top of the survey.
Alex collects the survey sheets and combines the results. Now your expertise is needed! Please fill out the file content that matches the file type, as well as recommending a particular piece of software.

Answers

Answer:

i tried but i can figure it out

Answer:

You have to fill into the table what the file type and recommendations are (for example, .xls is a spreadsheet and Excel is the software is the recommendation).  Hope that helps a bit!

Explanation:

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:

What is the shortcut key to launch the Macros dialog box?
A. Alt+F7
B. Alt+F8
C. Ctrl+F8
D. Ctrl+F7

Answers

Answer:

On excel, Ctrl + F8 is the shortcut for the Macros dialog box

Explanation:

Answer:

Alt +F8

Explanation:

edge 2022

Which phrase best describes a scenario in Excel 2016?

Answers

Answer:

what are the phrases?

Explanation:

Which of the following are examples of packages you can import and use classes from in java?

Choose all options that apply.


A. Main.main

B. java.util

C. java.double

D. java.int

E. edhesive.shapes

Answers

it’s D java. int i think

Introduction:

Java is a computer programming language. A computer programmer may use package in java which is a mechanism to encapsulate a group of classes and then import it to sub package interfaces.

Explanation:

These package help to prevent the issues of naming conflicts. The examples of packages which can import and use classes from in java are

Conclusion:

A. Main.main

B. Java.util

D. java.int

Learn more at https://brainly.com/question/17882992

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.

Which layer of the TCP/IP model is concerned with the physical transportation and delivery of network data?

application

network access

internet

transport

Answers

Answer:

network accsses

Explanation:

Answer:

Network Access

Explanation:

how has input device helped u

Answers

Answer:

Today, input devices are important because they are what allows you to interact with and add new information to a computer. For example, if a computer had no input devices, it could run by itself but there would be no way to change its settings, fix errors, or other various user interactions

Explanation:

Answer: well it allows u to ad new info to your pc/ basically an easier way to transfer from one device to another

Explanation: i would give a better answer but i'm feeling lazy today srry

modern warfare players here lol

Answers

Answer:

The answer to this is: lol

Explanation:

Answer:

Gimme Dat UserName

Mine                 is            meterhopper

Explanation:

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

Each Main Tab in the Ribbon has different Groups containing icons.
True Or False

Answers

Answer:

i think true

Explanation:

The ____ logic unit is responsible for the execution of arithmetic and logical operations.

Answers

Answer:

The arithmetic/logic unit(ALU)

Explanation:

This unit executes all arithmetic and logical operations through the electrical circuitry it has.

Other Questions
True or False? Complementary Angles are two angles that add up to 90 degrees How many serious delinquent offenses put a juvenile at risk of being charged as an adult?O fourO fiveO sixO seven over the course of Elisha's interaction with the stranger how do her feelings and actions toward him change What was a positve aspect of interaction between French settlers and American Indians? Yall know any movie sites I can go on? According to the kinetic theory, what happens when the temperature of waterincreases?The water molecules increase their speed.The water molecules do not change speed.The water molecules decrease their speed. uhh I need help, yes ik Im dumb any changes music elements used version in instrumental version PLZZZ ITS HARD I NEED HEEEELPRequiring settlers to practice the Catholic religion was one approach Mexican officials tried to maintain Mexican culture when issuing land grants to Anglo empresarios. True or False Which scientist discovered the electron? A case of soda has 24 cans in it. There are 12 cases of soda. 1) What is the total number of cans of soda there are? 2) The soda is donated to 7 (seven) teams. How many cans of soda does each team get? {include remainder} PLEASE HELP ME Are humans predators in their ecosystem? Explain in at least 5 sentences. denver company issued bonds with a face value of 100,000 and stated interest rate of 8%. the bonds have a life of five years and were sold at 102 1/2. if denver amoritizes discounts and premiums using the straight line method, the amount of interest expense each full year would be 50 points**I need a sentence that has a noun, verb, adjective, and adverb. write an equation to solve for x what is the value of x will mark brainious this is very confusing for me Cross out any letter below that is capitalized or abbrevaited incorrectly.1. home of mrs goodwrench Assuming the same interest rate, amount borrowed, and amortization period, which compounding (payment) period - monthly or annually - would result in less interest being paid by the borrower? Why? how many miles are in 234,230 feet ? If convection cells in the asthenosphere are the mechanism behind plate tectonic movement, what powers the convection cells?a) energy from the sunb) energy from the earth's core c) air pressure changes d) energy from magma which type of matter is represented by the particle diagram