Skip to main content

Linux shell script Practice Questions



1) Use a for loop to show users existing in the system. The output should be in a tabular format.

2) Use a table to display the network interfaces in the system.

3) Display output in the format

********Hello***********
-------------------------------------
| Sr. No. | Test | Test1 | Yes  |
-------------------------------------
|   10      | ABC| DEF | Yes  |
|   20      | DEF | FKG|  Yes |
------------------------------------

4) Write a script to print table of 2 in below format

2*1 = 2
2*2 = 4
......
2*10 = 20

5) Display the following menu to user
  a) Add
  b) Subtract
  c) Multiply
  d) Divide
Then ask for his choice of operation(a-d). Then get two numbers from user and perform the operation.


6) Take a number from user and print a triangle of stars from that number. For e.g. if user enters 3

*
**
***

7) Write a script that takes two arguments search and replace and the third argument is a filename. The script should search for that search term in the file and replace it with the replace term .

8) Take three numbers from user and find which one is the biggest of all.

9) Take a filename and check if it exists

10) Take a filename and check if write permission is granted

11) Take 7 numbers and make a sum of these numbers.

12) Write a shell script that adds a extension .text to all files in a specified directory

13) Write a shell script to backup any specified folder as a tar file.

Comments

Popular posts from this blog

Tally server gives license information while doing integration

When tally server gives this response <!DOCTYPE html><html><body><RESPONSE>License server is Running<br><br><b>Product : </b>Tally.ERP 9<br><b>Serial number : </b>xxxxxxxxxx<br><b>License state : </b> Permanent License<br><br><b>Product : </b>Tally.Developer 9<br><b>Serial number : </b>(Not Applicable)<br><b>License state : </b> No License<br><br><b>Product : </b>Shoper 9<br><b>Serial number : </b>(Not Applicable)<br><b>License state : </b> No License<br><br><b>Product : </b>Tally.Server 9<br><b>Serial number : </b>(Not Applicable)<br><b>License state : </b> No License<br></RESPONSE></body></html> problem maybe with the port number given in the tally advanced configuration settings. Try integrat...

Taking Backup of contacts in iPhone

Here is how to back up your  iPhone  contacts on a PC.  1) Open i-tunes on your computer that you sync it to 2) Plug in your iPhone to the PC 3) open "Address book" window's address book program. Kinda lame, but it works. Its under start-programs-accessories - Back to  iTunes , click on the phone icon on the left - Click on the Info, and under "Contacts" (the first one) check "sync contacts from" and then pick "Windows address book" from the drop down menu - Click all contacts - Then at the bottom right of  iTunes , click "Sync" It will ask you if you want to merge or replace. Make sure you select "MERGE" or it will delete your contacts on the phone.  Thats it, check your Windows Address Book and everything should be there. All the numbers and emails that you have put so much time into adding to your phone. Pretty nice. So, from now on, if you add contacts to the phone it will back up to the Computer and the Co...