UNIX/Linux Programming Answers

Questions: 170

Answers by our Experts: 135

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Question 1: Write a menu driven shell script which accepts a number N and an option to calculate the average of: 

first ‘N’ odd numbers

first ‘N’ even numbers

Sample Input and Output:

Enter a number : 

5

Menu 

Even : E

Odd: O

Enter E or O: 

E

The sum of even number is : 6


Following is the first four records in a file “data.txt”. 

71723 Ram     Sen     70 72 75 

91924 Raghubir Yadav   82 73 80

53425 Ram     Chauhan 93 81 86

44917 Ratan    Yadav   95 79 91

Each record contains ID(5 chars), 1 space, First name (10 chars),1 space, Second name (8 chars), 1space, marks in physics( 3chars), 1space, marks in chemistry(3 chars), 1space, marks in mathematics(3 chars) and a newline character.  

Write a shell program info.sh to achieve the following

If the program is run without any argument (sh info.sh), it will display the first name, second name and average score of each student in the file. 

If the program is run with numeric argument (sh info.sh 44917), it will assume it as ID of student and will output ID, first name, second name and the average score of that student. If ID does not match, the program should display “record not found”.

If the program is run with non-numeric

If the number of arguments is greater than one, the program should display an error message.


Write a shell script using while loop to repeat something several times for several things.


Write a shell script to display a file content on screen passed as command line argument


 

Write the commands to perfom the tasks mentioned below on a word document and upolad the document.                                       

1.                  A command to list the details of all the files and directories in your current directory.

2.                  List the contents of all the file directories starting with “d” in the /etc directories

3.                  In the directory named Documents create two directories named classwork1a and classwork1b.

4.                  In the classwork1a create two files label.txt and practice.txt.

5.                  Copy the file label.txt from classwork1a into classwork1b.

6.                  Create a symbolic link of practice.txt on the Desktop.

7.                  Rename label.txt to new_label.txt

8.                  Copy the file host.conf from the directory /etc into the directory classwork1a.

9.                  Display the first 15 lines of the file.


Write a shell script to determine if an input number is a palindrome or not.


Write a shell script using Nested for loops of your own and explain each statement of that script. Explanation



Write a shell script to determine if an input number is a palindrome or not.



Write a shell script that, given a file name as the argument will write the even numbered line to a file with name even file and odd numbered lines in a text file called odd file.



Write a menu driven shell script using the select statement to print calories for food items such as pizza, burger, Salad, Pasta etc



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS