Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is wrong with this code? # ! / bin / bash echo = = = = = = = = = = =

What is wrong with this code? #!/bin/bash
echo "========================="
echo "Developer: Lino J Leos"
echo "========================="
# Available tools
tool=("Hammer" "pliers" "Saw" "Screwdriver" "Mallet")
echo "See what you can get free if you buy one"
# Prompt user for choice
read -p "Enter the tool bought [enter Hammer, Pliers, Saw, Screwdriver, Mallet]: " choice
if [[" ${tool[*]}"=~ " ${choice}"]]; then
Echo "You have bought a: $choice"
# Remove the chosen tool from list
free_tool=("${tool[@]/$choice}")
tool2=("Hammer"
"pliers"
"Saw"
"Screwdriver"
"Mallet" -"$free_tool")
# Select a free tool
echo -e"$tool2"
echo "As part of our special offer, you get a free $free_tool with your purchase!"
read -p "Enter the free tool picked [enter $tool]: " choice2
if [[" ${tool2[*]}"=~ "${choice2}"]]; then
echo "You have chosen: " $choice2"
else
echo "Error: Please enter a valid tool name from the list"
fi
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

Students also viewed these Databases questions

Question

Describe how arousal and expressive behaviors interact in emotion.

Answered: 1 week ago