
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
This is for Linux
Q1: Write the script to do the following, Ask the user to enter an integer, and output whether the given number is even or odd
![-/Documents
1 #!/bin/bash
2 real number
3 if [ $(($number% 2)) -eq 0]
4 then
5 echo "$number is even"
6 else
7 echo "$number is odd"
8 fi
Help
sh
Tab Width: 8
Ln 8, Col 3
INS
Activate Windows](https://content.bartleby.com/qna-images/question/86bfc21f-7304-4d6a-8ae3-de059a5180e7/713c6aea-7da5-4ffc-9a9a-96a779cb9a7c/knemkp4_thumbnail.png)
Transcribed Image Text:-/Documents
1 #!/bin/bash
2 real number
3 if [ $(($number% 2)) -eq 0]
4 then
5 echo "$number is even"
6 else
7 echo "$number is odd"
8 fi
Help
sh
Tab Width: 8
Ln 8, Col 3
INS
Activate Windows
![Activities
Terminal
May 22 07:14
alex@ubuntu: ~/Documents
alex@ubuntu:~/Documents$ cat oddoreven.sh
#!/bin/bash
real number
if [ $(($number%2)) -eq 0]
then
echo "$number is even"
else
echo "$number is odd"
fi
alex@ubuntu:~/Documents$ sh oddoreven.sh
oddoreven.sh: 2: real: not found
2 oddoreven.sh: 3: arithmetic expression: expecting primary: "%2"
alex@ubuntu:~/Documents$
Activate WindewG](https://content.bartleby.com/qna-images/question/86bfc21f-7304-4d6a-8ae3-de059a5180e7/713c6aea-7da5-4ffc-9a9a-96a779cb9a7c/qnhyr4a_thumbnail.png)
Transcribed Image Text:Activities
Terminal
May 22 07:14
alex@ubuntu: ~/Documents
alex@ubuntu:~/Documents$ cat oddoreven.sh
#!/bin/bash
real number
if [ $(($number%2)) -eq 0]
then
echo "$number is even"
else
echo "$number is odd"
fi
alex@ubuntu:~/Documents$ sh oddoreven.sh
oddoreven.sh: 2: real: not found
2 oddoreven.sh: 3: arithmetic expression: expecting primary: "%2"
alex@ubuntu:~/Documents$
Activate WindewG
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Evaluate the following Postfix: "4 9 + 8 * 1 - 6 6 + - 13 - 2 /" (All the numbers are in single digit. Everything is separated with a space)* 50.0 49.5 39.5 39 38 76arrow_forwardI'm stuck on this problem, and here's what I'm stumped on: Meadowdale Dairy Farm sells organic brown eggs to consumers in the surrounding area. For a dozen eggs, it charges $3.25, and for individual eggs that are not part of a dozen, it charges 45 cents each egg. Using the following phrasing, write a program that prompts a user to enter the number of eggs in the order and then displays the amount owed along with a detailed explanation of why the amount is due: You placed an order for 27 eggs. There are 2 dozen eggs at $3.25 per dozen and 3 loose eggs at 45 cents each, which adds up to a total of $7.85.arrow_forwardDetermine the final value of the postfix expression below. If dividing by zero, answer "error". All operands are single digits. Final result may be negative and/or non-integer. 5 8 7 * 2 - + 8 *arrow_forward
- Hi, need help with this code. my professor mentions that we need to use if and switch statements for this code. In not sure if both switch and if statements can be used in the same code. the code below only has if statements. can both switch and if can be used? need help please. I provided pictures of code instructions and how the output/input validation needs to look. #include <iostream>#include <string>#include <cmath>using namespace std;int main(){//variables and constantsint packageType;double dataUsed;double monthlyCharges = 0.0; // Name of the programcout << "iMobile Bill Calculator ..." << endl; // Display the pacakge options for user to pickwhile (true){cout << "\nSelect a subscription :" << endl;;cout << "\t\t1. Package A" << endl;cout << "\t\t2. Package B" << endl;cout << "\t\t3. Package C" << endl;cout << "Package: ";cin >> packageType; // When a package number is not vaildif…arrow_forwardI keep running this code as seen in the first picture and it keep giving me this error message seen in the second picture and I don't understand why. the initial question is: Allow a user to enter any number of double values up to 15. The user should enter 99999 to quit entering numbers. Display an error message if the user quits without entering any numbers; otherwise, display each entered value and its distance from the average. if that helpsarrow_forwardAsk the user for an account balance. Show, in descending order, all the accounts that have a balance greater than what the user input. Each entry is int, string, long, double, boolean (name length, name, credit card number, balance, cashback). i need the display produced from the code to be in descending order, it is displaying the opposite it also needs to produce yes or no instead of boolean true/ false this is my current code: import java.io.*;import java.util.*; public class AccountBalance { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a balance"); double input = keyboard.nextDouble(); // Create an ArrayList to store Account objects ArrayList<Account> accounts = new ArrayList<>(); try { // Open the binary file for reading DataInputStream inputstream = new DataInputStream(new FileInputStream("accounts-with-names.dat")); //…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- 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

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education