System Software Lab Programs ( UNIX Programs ) – 6a

// June 6th, 2009 // Educational, Engineering, Unix and System Software Lab

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

[Click Here to get other programs by email ]

………………………………………………………………………………………………………………………….
PART -B

………………………………………………………………………………………………………………………….

6. 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

[Click Here to get other programs by email ]