Good evening all,
As the title says, I am attempting to parse through a csv file of about 400 lines and add each one using the below script. This is part of a homework assignment and I am not sure what exactly I am doing wrong.
#!/bin/bash
while IFS=, read -r userName firstName lastName gender dob language bloodType zodiac constellation planet genre dino;
do
ldapadd -x -w 1234568 -D cn=admin,dc=SAMPLE,dc=CLASS,dc=SCHOOL,dc=edu
dn: uid=$userName,ou=people,dc=SAMPLE,dc=CLASS,dc=SCHOOL,dc=edu
objectClass: person
objectClass: top
objectClass: inetorgperson
uid: $userName
cn: $firstName $lastName
sn: $lastName
description: $dob
done < Males.csv
I am unsure what I am doing wrong, as I keep getting the error: "ldapadd: invalid format (line 1) entry: """
dn:
to$dob
. 3. Does your script really have that oneldapadd
command across multiple lines without backslash-escaping the newlines? or is that just how you edited it for readability here on this site? but note that quoted multi-line strings don't need backslash at EOL.