0% found this document useful (0 votes)
27 views1 page

Assignment 08 Shell

This document outlines 9 assignments for a shell scripting course. The assignments include: 1) Writing a script that prints a message and stores it in a variable. 2) Printing environment variables. 3) Storing and displaying the hostname. 4) Performing math operations on user-input numbers. 5) Calculating geometry for rectangles and circles from arguments. 6) Converting between Fahrenheit and Celsius temperatures. 7) Using special variables with arguments. 8) Working with arrays of fruits. 9) Creating arrays from command line arguments.

Uploaded by

harishrealmepadx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
27 views1 page

Assignment 08 Shell

This document outlines 9 assignments for a shell scripting course. The assignments include: 1) Writing a script that prints a message and stores it in a variable. 2) Printing environment variables. 3) Storing and displaying the hostname. 4) Performing math operations on user-input numbers. 5) Calculating geometry for rectangles and circles from arguments. 6) Converting between Fahrenheit and Celsius temperatures. 7) Using special variables with arguments. 8) Working with arrays of fruits. 9) Creating arrays from command line arguments.

Uploaded by

harishrealmepadx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 1

UNIX and Shell Programming

Assignment 8 : Shell Scripting

1. Write a shell script that prints “Shell Scripting is Fun!” on the screen. Modify the
shell script above to include a variable. The variable will hold the contents of the
message “Shell Scripting is Fun!”.

2. Print the values of the environment variables HOME, USER, SHELL and PATH
with set, print env and echo.

3. Store the output of the command “hostname” in a variable. Display “This script is
running on _.” where “_” is the output of the “hostname” command.

4. Get two numbers a and b from user using read statement. Do the following:
a. Add the two numbers
b. Subtract the numbers
c. Multiply the numbers
d. Divide the numbers
Print the result.

5. Get length and breadth for a rectangle and radius for a circle using command line
argument. Calculate area and perimeter of the rectangle and also area and
circumference of a circle. Use the special character data types and display the
arguments using them.

6. Temperature of a city in Fahrenheit degree is input through the keyboard. Write


a program to convert this temperature into Centigrade degrees.
Formula is
c = (f - 32)*5 /9
f=9/5*c+32
7. Write a shell script to implement the propery of special variable using command
line argument.
8. Write a shell script to declare an array with fruits as elements. Print the
following.
a. Print the elements at first and last index
b. Print all elements in the array.
c. Number of elements in the array
9. Write a shell script to create array of elements using command line arugment.

You might also like