0% found this document useful (0 votes)
27 views15 pages

Final Shell Practical File-1

The document is a practical file for an Operating System lab by Yaman Ahlawat, detailing various shell script exercises. Each exercise includes a brief description of the task, the corresponding code, and the expected output when executed. Topics covered include file operations, case statements, string manipulation, loops, and mathematical computations.

Uploaded by

akshita
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views15 pages

Final Shell Practical File-1

The document is a practical file for an Operating System lab by Yaman Ahlawat, detailing various shell script exercises. Each exercise includes a brief description of the task, the corresponding code, and the expected output when executed. Topics covered include file operations, case statements, string manipulation, loops, and mathematical computations.

Uploaded by

akshita
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

OPERATING SYSTEM LAB PRACTICAL FILE

Name: Yaman Ahlawat


Course: BCA

1. Case statement file operations


CODE:
case example code...

OUTPUT:
$ sh [Link]
Enter file: [Link]
2
15 [Link]
2. Lowercase to uppercase
CODE:
tr 'a-z' 'A-Z' < [Link] > [Link]

OUTPUT:
$ cat [Link]
hello
$ cat [Link]
HELLO
3. Uppercase to lowercase
CODE:
tr 'A-Z' 'a-z' < [Link] > [Link]

OUTPUT:
$ cat [Link]
HELLO
$ cat [Link]
hello
4. Table of number
CODE:
for loop table code

OUTPUT:
$ sh [Link]
Enter number: 3
3 6 9 12
5. Case statement 2
CODE:
case code

OUTPUT:
$ sh [Link]
1
(file content shown)
6. File or directory
CODE:
if condition code

OUTPUT:
$ sh [Link]
[Link]
It is a file
7. Command line input
CODE:
echo $1 $2 $3

OUTPUT:
$ sh [Link] Yaman Ahlawat 2005
8. Print word n times
CODE:
loop code

OUTPUT:
$ sh [Link] 3 hello
hello
hello
hello
9. Sort integers
CODE:
sort code

OUTPUT:
$ sh [Link]
5 2 1
1 2 5
10. Date options
CODE:
date case code

OUTPUT:
$ sh [Link]
1
12:30:45
11. Factorial
CODE:
factorial code

OUTPUT:
$ sh [Link]
5
120
12. Fibonacci
CODE:
fibonacci code

OUTPUT:
$ sh [Link]
5
0 1 1 2 3
13. Multiplication table 1-10
CODE:
nested loop code

OUTPUT:
$ sh [Link]
(table shown)
14. Reverse number
CODE:
reverse code

OUTPUT:
$ sh [Link]
123
321
15. HCF
CODE:
hcf code

OUTPUT:
$ sh [Link]
12 18
6

You might also like