Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I started the answers already and I am providing the output as well. I need to know my mistake as well as the correct answer.

I started the answers already and I am providing the output as well. I need to know my mistake as well as the correct answer. image text in transcribed

image text in transcribed

Questions:

Create a series of shell script files, where each one does the following:

  • Takes as input two numbers and adds, subtracts, multiplies and divides the values.
  • Takes as input one number and tests if the number is greater than 10, if the number is less than 10, if the number is greater than or equal to 10, if the number is lesser than or equal to 10
  • Takes as input a filename and checks permission for read, write and execute.
  • Takes as input a filename and checks if it is a file or a directory

Pasted from Text File:

echo "Enter first number" read numb1 echo "Enter second number" read numb2

((sum=$numb1 + $numb2)) echo "The sum of $numb1 and $numb2 is $sum."

((diff=$numb1 - $numb2)) echo "The difference between $numb1 and $numb2 is $diff"

((product= $numb1 * $numb2)) echo "The product of $numb1 and $numb2 is $product."

((quo=$numb1/$numb2)) echo "The quotient of $numb1 and $numb2 is $quo."

echo "Enter Number" read number if test $number -gt 10 then echo "Number is greater than 10" fi if test $number -lt 10 then echo "Number is less than 10" fi

echo "Enter file name" read file [-w $file] && w="Write=Yes" || w="Write=No" [-x $file] && x="Execute=Yes" || x="Execute=No" [-r $file] && r="Read=Yes" || r="Read=No"

echo "$file permissions" echo "$w" echo "$r" echo "$x"

echo "Enter File Name" read fname

THE QUESTION IS: TAKE AN INPUT AS FILENAME AND CHECK PERMISSION FOR READ, WRITE AND EXECUTE. echo Enter file name read file [-w sfile] &&W="Write=yes" w="Writerno" [-x file] && x="Execute=Yes" = Execute=NO 1-1 $file] && r="Read=Yes" III "Read=N"|| echo "Stile permissions echo "SW" echo "Sr echo "x" THE QUESTION IS: TAKE AN INPUT A FILENAME AND CHECK IF IT IS A FILE OR A DIRECTORY echo "Enter File Name read fname Elif [-f siname] then 5 echo "Siname 15 a FILE 6 -fi if [-d siname] then echo "Siname is a DIRECTORY fi E1 62 63 59 s bash Programi.sh Enter first number 20 Enter second number 5 The sum of 20 and 5 is 25. The difference between 20 and 5 is 15 The product of 20 and 5 is 100. The quotient of 20 and 5 is 4. Enter Number 60 Number is greater than 10 Enter file name homework3 Programi.sh: line 35 : [-w: command not found Programi.sh: line 36: [-x: command not found Programi.sh: line 37: [-r: command not found homework3 permissions Write=No Read=No Execute=No Enter File Name homework3.c Programi.sh: line 46: [-f: command not found Programi.sh: line 50: [-d: command not found

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

Students also viewed these Databases questions