I seem to be having trouble with a piece of code I'm writing (at least I think anyways). It's a script that parses a text file called test3_data.txt with a bunch of user ID's in them, and puts those user Id's into a variable called "USER_ID". I then test to see if they have a home directory with whatever text is in the USER_ID variable. If so, it deletes the user from the system, along with their files, home directory, etc. The script works fine, but when it's done running, the man pages for the userdel command show up. Is there anyway to stop that from happening? Is their something wrong with my code? Thanks! and here is my code.
!/bin/sh
while read IN_RECORD
do
#Variable that reads user id
USER_ID=`echo $IN_RECORD |cut -d'|' -f1`
#Remove added users from data file.
test -d /home/{$USER_ID}
if [ "$?" = "1" ];
then
userdel -r $USER_ID
fi
done < test3_data.txt