OS Lab 5 Journal 11102023 083703am
OS Lab 5 Journal 11102023 083703am
OS Lab 5 Journal 11102023 083703am
CSL 320
Lab Journal 5
TALHA ARSHAD
01-134201-090
BS-CS-5B
Task # 1: Write a script that asks the user to enter three sides of a triangle, calculate its perimeter
and display it in the following format.
The perimeter of triangle with side 1 = ____ side 2 = ____ and side 3 = ____ is: ______.
[Formula: Perimeter of triangle is: side1 + side2 + side3]
Program:
Output:
Task # 2: Write a script that asks the user to enter two integer numbers, stores them in variable
'num1' and 'num2' respectively. The program swaps the values of two variables with each other
using a third variable 'temp' and displays the values of both variables after swapping.
Program:
Output:
Task # 3: Write a script that asks user the radius of a circle, calculate its area and display it in the
following format.
The area of circle with the radius ______ is: _____________.
[Formula: Area of Circle is: πr2]
Program:
Output:
Task # 4: Write a script that takes masses of two objects m1 and m2 and the distance d between
them from user. Now find the gravitational force between the two objects. The formula for the
gravitational force is given.
[Hint: Value of G=6.67×10−11 ]
Program:
Output:
Title: Linux Shell Programming II
Objectives: To study and learn Linux Shell Programming Commands, Relational & logical
operators, Conditional Statements.
Tools Used: Linux Ubuntu Terminal, geddit editor, VS Code
Task # 1: Write a script to find the smallest number from 3 numbers given by user.
Program:
#Write your code here
Output:
#Paste snapshot of your output here
Task # 2: Make a simple calculator which has a nice menu e.g press 1 for addition and so on. It
should have following the functions: Addition, subtraction, division, multiplication and modulus.
Program:
Output:
Task # 3: Through case write a shell script that can differentiate between vowels and consonants.
Program:
#!/bin/bash
Output:
Task # 4: Write a script to find whether a particular triangle is equilateral, isosceles or scalene.
Program:
Output:
Task # 5: Save the path of any file in a variable and write a script to automatically perform all file
tests on it.
Bonus: Take the filename from user, check if it exists then perform file testing on it, otherwise
echo on screen that file doesn’t exist.
Program:
#Write your code here
Output:
#Paste snapshot of your output here
Submission Date