Question

Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a...

Hi, I need help for solving Linux question.

.

1.Using the proper text editor, create a shell file called by (your name), your enrollment number, your program and the courses you study. Use the appropriate variables and display the above to the standard output (screen).

.

2. Write A Shell Script to perform the following:

  1. Display the files and directories
  2. Print the date in 24 hour format
  3. Display the System id
  4. Display the current working directory
  5. Print the status of process running on the system

3. Write a Shell script program on the manipulation of strings using different string techniques.

.

4. Write a shell script to find the greatest and lowest of three numbers.

.

5. Write a shell script program to display the number and name of each month from 1 - 12. (Use any construct)

.

6. Write a shell script to add the numbers natural numbers from 0 – 10.

.

7. Calculate odd and even numbers from 1 till 20, using shell scripting.

.

8. Write the script to print the Sum and Reverse of the Given Number.

.

9. How to read the arguments “Hi, my name is (your name)” passed to a shell script from the command line. Also, the script has to print the script name and the total number of arguments.

.

  1. Give the proper explanation/ examples / syntax / scripts to show the use of the following tools / utilities:
  1. yum
  2. rpm
  3. du
  4. fstab
  5.   fsck
  6. Mount/umount
  7. Hostname
0 0
Add a comment Improve this question Transcribed image text
Answer #1

(4) Shell script to find the greatest and lowest of three numbers

echo "Enter three Integers:"

read a b c
#check whether "a" is greater than "b and c"
if [ $a -gt $b -a $a -gt $c ]

then
  
echo "$a is Greatest"

#check whether "b" is greater than "c and a"

elif [ $b -gt $c -a $b -gt $a ]

then
  
echo "$b is Greatest"

#above both eqations fails then "c" is greatest
else

echo "$c is Greatest!"

fi


#check whether "a" is less than "b and c"

if [ $a -lt $b -a $a -lt $c ]

then

echo "$a is Lowest"

#check whether "b" is less than "c and a"

elif [ $b -lt $c -a $b -lt $a ]

then

echo "$b is Lowest"

#above both eqations fails then "c" is lowest
else

echo "$c is Lowest!"

fi


(6) Shell script to add the numbers natural numbers from 0 – 10

# store single digit
i=1
# store number of digit
sum=0
# use while loop to caclulate the sum of all number
while [ $i -le 10 ]
do
sum=$(( $sum + $i )) # calculate sum of number
i=$(( $i + 1 ))
done
echo "Sum of Natural numbers is $sum"

(7) Using shell scripting Calculate odd and even numbers from 1 till 20

echo “First Odd and Even number till 20 are”
n=1
#use while loop checks "n" is less than 20
while [ $n -lt 20 ]
do
out=$(( $n % 2 ))
#check the number is EVEN or ODD
if [ $out -eq 0 ]
then
echo $n is even number
else
echo $n is ODD number
fi
#Loop continue upto 19
n=$(( $n + 1 ))
done

(8) Write the script to print the Sum and Reverse of the Given Number

echo "enter the no"

read n

s1=0

s2=0

#use while loop find out number is not equal to zero
while [ $n -ne 0 ]

do

#separte each digit and places it in "s1" to display REVERSE of number
t=`expr $n % 10`

s1=`expr $s1 \* 10`

s1=`expr $s1 + $t`
#separte each digit and places it in "s2" to display SUM of number
s2=`expr $s2 + $t`

n=`expr $n / 10`

done

echo "Sum of given number is $s2"
echo "Reverse of given number is $s1"


Add a comment
Know the answer?
Add Answer to:
Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • UNIX help!!!! I need what the text would look like in the vi editor. also note...

    UNIX help!!!! I need what the text would look like in the vi editor. also note this question has been posted before and the answers were all wrong!! Write a shell script (bash or sh) that prints out the following lines/information: Only your name may be hard coded, the rest must be obtained programmatically within the shell script. Name: "Your name" Hostname: "The computer's hostname" Host IP: "The computer's IP number" Default Gateway: "The computer's default gateway" OS Version: "Whatever...

  • Programs/scripts 13. Write a bash shell script that displays the date by using the shell command...

    Programs/scripts 13. Write a bash shell script that displays the date by using the shell command date. 14. Write a command line program that takes a number and a command as arguments. Call that command that number of times. For example, if your program name is "test" test 3 dir <shows directory> dir <shows directory> dir <shows directory>

  • Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...

    Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell variables, and .profile script file, echo SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME. Do not give just the value of...

  • dont know how to do Create a web page using a text editor. Name the file...

    dont know how to do Create a web page using a text editor. Name the file with your name and the number of the assignment. Submit the assignment via D2L by 5:00 on the due date. Put your name on the last line in camelCase. Write a JavaScript function that gets a number from two to twenty-five from the user. Reject numbers that aren't in that range. Then find the double, square and total of all three numbers. Display all...

  • Homework No.2 CSC 222 Write a shell script program called "countf.sh" that will count how many...

    Homework No.2 CSC 222 Write a shell script program called "countf.sh" that will count how many files or directories recursively. beside the file counts, also report how many files for each types (directory or regular files). It will either take arguments for specific directories and no argument. If no argument, it will read the current working directory as the starting point. Please also provide -h option to print out how to use your countf.sh program % ./countf.sh % ./countf.sh file1...

  • i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and...

    i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and Report Search Report host path date Execution time nnn Directories n, nnn, nnn Files nnnnnnn Sym links nnnnnnn Old files nnnnnnn Large files nnnn, nnn Graphics files nnnnnnn Executable files nnnnnnn Temporary files n, nnn, nnn TotalFileSize nnnn, nnn Introduction Lab 7 is nearly identical to Lab 2, except it is written in PowerShell, uses no UNIX/Linux tools to do its work, creates no...

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

  • lab software using cygwin part1 part2 1 of 1 1. Write a shell program name it...

    lab software using cygwin part1 part2 1 of 1 1. Write a shell program name it "lab4q1.sh" to compare the two strings: a. Read the first string. b. Read the second string. c. If the strings are empty print "String Empty" and exit using the statement exit 1. d. Compare the two strings using the if and print longer string. e. If the size of both strings is same, then print that two strings are equal (use printf), otherwise, print...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT