I'm trying to manipulate csv data to only delete users with specific header attributes by creating a script file and running it, then it will read data from a csv and delete the users with specific information in their line... but when I run this script, it gives errors and shows information such as all the commands to use but when I go through the list of commands it gives, it doesn't work.
mycsv.csv
username,first,last,gender,dob,countries,airports,shells,cuisines,operands,water,nfl
mb8239,maaran,batey,m,april 16 1993,japan,tpa,sh,spanish,multiplication,hint,49ers
INPUT=mycsv.csv
OLDIFS=$IFS
IFS=','
while read username first last gender dob countries airports shells cuisines operands water nfl
do
if [ $shells == "sh" ]
then
userdel -r
fi
done < $INPUT
IFS=$OLDIFS
From what I understand, if im trying to remove the users using the shell 'sh' then i would do userdel -r no?