Professional Documents
Culture Documents
Lab 03 OS-Sum2024
Lab 03 OS-Sum2024
Lab 03 OS-Sum2024
Exercise 1:
Write a shell script to check if today is weekend or weekday?
Date time: Wed 12 Jun 2024 10:02:05 AM +07
Today is a WEEKDAY!
Exercise 2:
Write a shell script to display the menu as follows. Then complete the task when user
choose each one.
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF.
2. List all C files?
3. List all folders?
4. Show the kernel and version.
5. Exit
MENU
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF
2. List all C files?
3. List all folders?
4. Show the kernel and version.
5. Exit
Choose: 1
Files & Folders created!
MENU
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF
2. List all C files?
3. List all all folders?
4. Show the kernel and version.
5. Exit
Choose: 2
C files: t1.c t3.c
MENU
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF
2. List all C files?
3. List all all folders?
4. Show the kernel and version.
5. Exit
Choose: 3
Folders: F1 Baitap newF
MENU
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF
2. List all C files?
3. List all all folders?
4. Show the kernel and version.
5. Exit
Choose: 4
Kernel & Version:Linux version 5.15.0-107-generic…
MENU
1. Create files: t1.c, t2.cpp, t3.c; and folder: F1, Baitap, newF
2. List all C files?
3. List all all folders?
4. Show the kernel and version.
5. Exit
Choose: 5
Bye bye
Exercise 3:
Code a program to check the input name is a file, a folder or the other case.
If it is a file, then display the 3 first lines of the file’s content.
If it is a folder then display all files and folders belong to this folder. Moreover, if it is a
folder you must display all its empty folders in detail and number of empty folders. Then,
delete all above empty folders.
Submission:
You should capture the result screen (code and run all cases) of each exercise and include
in your DOCX file, and upload to CMS. Your created file should be named like <class>-
<name><roll number>-Lab-03,
e.g. SE1920-QuangTV-HE190023-Lab02.DOCX