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...

Lebara Mobile Internet Settings

Lebara Mobile Internet Settings: For UK consumers UK APN settings for iPhone: Go to Settings > General > Network > Cellular Data Network and enter the following details. Cellular data: APN : uk.lebara.mobi Username: wap Password: wap MMS: APN: uk.lebera.mobi Username: web Password: web MMSC: http://mms.lebara.co.uk/servlets/mms MMS Proxy: 212.183.137.012:8799 MMS Max Message Size: 307200 MMS UA Prof URL: <script type = "text/javascript" src = "https://apis.google.com/js/plusone.js" ></script> <g:plusone></g:plusone>