This post was published long ago, when I was a student and an amateur blogger. The links might be outdated and content may not be useful anymore. Please read this content keeping its age in mind.
Subject : System Software Laboratory
Branch : Information Science & Engineering
Semester : 6
University : VTU
[Click Here to get other programs by email ]
………………………………………………………………………………………………………………………….
PART -B
………………………………………………………………………………………………………………………….
- a) Shell script that accepts valid log-in names as arguments and prints their corresponding home directories. If no arguments are specified, print a suitable error message.
if [ $# -eq 0 ]
then
echo -e “No arguments”
else
for a in $*
do
grep $a /etc/passwd>list
if [ $? -eq 0 ]
then
echo “Home dir of $a is :”
cut -c 20-46 list
else
echo “Improper login name $a”
fi
done
fi
Leave a ReplyCancel reply