31 January 2022

Shell Scripting With Basic Examples

1.      Write a shell script to evaluate arithmetic operations. (addition, subtraction, multiplication and division)

 Step 1 Creating script file using Nano editor





Step 2 Writing code with no error and save the script




Step 3 Gives execute permission and then run the script and get input from user and see the output





2.      Write a shell script to calculate simple interest.

 Step 1 Creating script file using Nano editor

Step 2 Writing code with no error and save the script



Step 3 Gives execute permission and then run the script and get input from user and see the output



3.      Write a shell Script to determine largest among three integer number.

 Step 1 Creating script file using Nano editor

Step 2 Writing code with no error and save the script



Step 3 Gives execute permission and then run the script and get input from user and see the output



4.      Write a shell script to find sum of first n natural numbers.

 Step 1 Creating script file using Nano editor


Step 2 Writing code with no error and save the script




Step 3 Gives execute permission and then run the script and get input from user and see the output



5.      Write a shell script to find whether a given number is prime.

 Step 1 Creating script file using Nano editor


Step 2 Writing code with no error and save the script



Step 3 Gives execute permission and then run the script and get input from user and see the output



6.      Write a shell script to find factorial of a given number.

 Step 1 Creating script file using Nano editor


Step 2 Writing code with no error and save the script



Step 3 Gives execute permission and then run the script and get input from user and see the output




7.       Write a shell script to compute LCM & GCD of two numbers.

 Step 1 Creating script file using Nano editor



Step 2 Writing code with no error and save the script



Step 3 Gives execute permission and then run the script and get input from user and see the output