I need to write a script that will take a list on login information and grep it to get the users home dir. The does a ls -lR looping through the home dirs. This is what I have written.
#! /bin/ksh
while read line
do
ls -lR `egrep "$line" locked_accounts.txt |awk -F: '{print $6}'` >> listolduser
.out
done < chkoldusers.in 2> listoldusererror.out
exit
The chkoldusers.in is a list of the login names.
The locked_accounts.txt is a copy of the users entery in the /etc/passwd file.
This works and gives all the info that I am looking for, but it also give a ls -lR of the dir I ran the script from.
Can anyone help me fix it?
Regards,
#! /bin/ksh
while read line
do
ls -lR `egrep "$line" locked_accounts.txt |awk -F: '{print $6}'` >> listolduser
.out
done < chkoldusers.in 2> listoldusererror.out
exit
The chkoldusers.in is a list of the login names.
The locked_accounts.txt is a copy of the users entery in the /etc/passwd file.
This works and gives all the info that I am looking for, but it also give a ls -lR of the dir I ran the script from.
Can anyone help me fix it?
Regards,