
Concept explainers
Hello guys,
Please i need a help in bash script (linux) ,if im allowed just to use nested ifs, i want to take numbers from user and each number will execute some statements; allowed inputs are 20,30,40. if the inputs entered were different then we should print a message "wrong number" and ask for entering again a number that is allowed.
if the input is 20 then it will execute : echo "20989"
if the input is 30 then it will execute3 : echo "90999"
if the input is 40 then it will execute : echo "40909 "

Bash Script:
while true
do
echo "Enter a number"
read num
if [ $num -eq 20 ]
then
echo "20989"
return
elif [ $num -eq 30 ]
then
echo "90999"
return
elif [ $num -eq 40 ]
then
echo "40909"
return
else
echo "wrong number"
fi
done
Screenshot of output:
Step by stepSolved in 2 steps with 1 images

- Shell Scripting: Write the output when the input is 40: echo -n "Enter any number:" read n if [ $n -eq 30 ] 11 [ $n -gt 50 ] then echo "1" else echo "2" fiarrow_forwardFind the Time Complexity = Find the Space Complexity =arrow_forwardC++ Also prompt the user for the total amount deposited. Do not accept a value less than zero; display an error message and exit the program if this occurs. If the number of checks entered is greater than zero, prompt the user for the total amount of the checks written. Do not accept a value of zero or less; provide an error message and exit if the user enters invalid data. We will also bring this problem into the 21st century and consider ATM transactions as well. Prompt the user for the number of ATM transactions. Like number of checks written, do not accept a negative number here. If the number of transactions is greater than zero, also prompt for the total amount withdrawn. Do not accept zero or less for that total amount. The first five ATM transactions are free; charge a dime for each subsequent transaction. If the balance after charges and withdrawals are applied but before the deposit is credited is less than the minimum balance of 400.00, charge them the low balance fee. Yes,…arrow_forward
- Please help using java Read the instructions carefullyarrow_forwardNEED THIS CODE IN JAVA SCRIPT. It must be executable.arrow_forwardSelect the appropriate output after running the following code block: aList = [1,2,3,4,5] if(8 not in aList): print("8 not in aList") else: print("8 in aList") Group of answer choices 8 not in aList 8 in aList 1,2,3,4,5 [1,2,3,4,5] Describe the action being executed by the former code block:arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





