Operating System
Operating System
Use Kaagaz
Practical performance & output of practicals
for OSY 22516 Download Now
Step 2: Create a Bootable USB Practical performance & output of practicals for
OSY 22516 Download Now
Exercise
S #EXERCISE PRACTICAL 3
S #Q.2 Wri.te the output of following comands
S #(i.) who;clear ;who al'l
S who
i.f5i.osy22516 :0 2023-06-12 13:31 (:0)
S who al'l i.
S #I can't use clear comand bacause want to capture thi.s output i.f used clear comand then all COl'll'land wi.ll be earas
ed
S #(ti.) who;tty;date
S who;tty;date
i.f5i.osy22516 :0 2023-06-12 13:31 (:0)
/dev/pts/0
Monday 12 June 2023 02:46:21 PM !ST
= sI
11 Be AatmaNirbhar. Use Kaagaz
12 Be AatmaNirbhar. Use Kaagaz
Practical performance & output of practicals for OSY
22516 Download Now
R ifSiosy22516@ifSlosy22516-VlrtuaIBox: -/PR11pattren
result=0
case $operator ln
+)
result=S((nuMl + nuM2))
echo "Addltlon: SnuMl + SnuM2 $result"
Practical performance & output of
-)
practicals for OSY 22516
result=S((nuMl - nuM2))
echo "Subtractlon: SnuMl - SnuM2 $result" Download Now
/)
result$((nuM1/nuM2))
echo "Dlvlslon: SnuMl / SnuM2 $result"
*)
echo "Invalld operator.·
exlt 1
esac
$ bash PR11EXQ3Math_sh
Enter the flrst nuMber:
6
Enter the second nuMber:
4
Enter the operator (+' - '/)
+
Addltlon: 6 + 4 = 10
sI
END OF PRACTICAL 11
********************************************
37 Be AatmaNirbhar. Use Kaagaz
38 Be AatmaNirbhar. Use Kaagaz
39 Be AatmaNirbhar. Use Kaagaz
Practical Performance Output
Subject: OSY 22516
Practical 12: Write Shell script to find out whether-
Given file exists?
Pogram code:
Write a shell script to find out whether- File read, Write &
execute permission
: $ #Practical 13 Wrlte a shell scrlpt to check and grant Flle perMlsslon
: $ #PrograM code: Wrlte Shell scrlpt $ #PrograM code: Wrlte Shell s
crlpt to flnd out whether- flle has read, wrlte and execute perMlsslon.
: $ cd Practlcal13
$ cat>PR_code_RWE_perMlssi.on.sh
# ProMpt the user to enter the flle path
read -p "Enter the flle path: " flle_path
# Check lf the file exists
if [ -e "$file_path" ]; then
# Check read perMission
H [ -r "$fi.le_path" ]; then
echo "Fi.le has read pemisslon. Practical performance & output of
else
fi.
echo "Fi.le does not have read pemlsslon." practicals for OSY 22516
# Check write perMtsslon Download Now
lf [ -w "Sfi.le_path" ]; then
echo "Flle has wrlte pemi.sslon."
else
echo 'Ti.le does not have write pemissi.on."
fi.
# Check execute perMi.ssi.on
if [ -x "Sfi.le_path" ]; then
echo "Fi.le has execute pemi.ssi.on."
else
echo "Fi.le does not have execute pemissi.on."
fi.
else
echo "Fi.le does not exist."
fi.
$ bash PR_code_RWE_perMi.ssi.on.sh
Enter the fi.le path: PR_code_RWE_perMi.ssi.on.sh
Fi.le has read perMi.ssi.on.
Fi.le has wri.te perMi.ssi.on.
Fi.le does not have execute perMissi.on.
$
Exercise
(1) Write a Shell script which displays lists of all executable files
in the current working directories
(2) Write a Shell script which displays lists of all files in current
directory to which user read, write and executable permission