Professional Documents
Culture Documents
2023-24
Name:Yash Lalchandani
Rollno :23MCA027
Practical_5
Output:-
Output:-
4. Generate list of all ordinary files in your current directory that are
not writable?
Output:-
5. Find out the name and designation of the youngest person who is
not 'Manager'
Output:-
Emp_Id,Name,Dept,Age,Gender,designation,Basic
Command:-
echo "Emp_Id,Name,Dept,Age,Gender,Designation,Basic" > emp.dat
echo "101,kamal,Clerk,22,Male,Clerk,30000" >> emp.dat
echo "102,jeet,Clerk,21,Female,Clerk,32000" >> emp.dat
echo "201,yash,Manager,25,Male,Manager,45000" >> emp.dat
echo "202,deepa,Manager,22,Female,Manager,50000" >> emp.dat
echo "301,jay,Director,25,Male,Director,60000" >> emp.dat
echo "302,gaurav,Director,20,Female,Director,70000" >> emp.dat
cat emp.dat
Output:-
Generate separate file for each department and add net salary field
and give increment as follows:
Command:- sh script.sh
#!/bin/bash
Department_File="${Dept}_file.dat"
if [ ! -e "$Department_File" ]; then
echo "Emp_Id|Name|Dept|Age|Gender|Designation|Basic|
Net_Salary" > "$Department_File"
fi
echo "$Emp_Id|$Name|$Dept|$Age|$Gender|$Designation|$Basic|
$Net_Salary" >> "$Department_File"
done < emp.dat
Output:-
Generate the report of each department for all the employees and
count the number of clerks,managers and Directors
Command:- sh script2.sh
#!/bin/bash
# Initialize counters
clerk_count=0
manager_count=0
director_count=0