I'm looking for a fast way to import customer users into otrs (ticket system) I have an export from Active Directory with:
firstname lastname password email username
There is a script in the otrs/bin folder with this script:
otrs.AddCustomerUser.pl [-f firstname] [-l lastname] [-p password] [-g groupname] [-e email] [-c CustomerID] username
if you define -g with a valid group name then the user will be added that group
So now I would like to have a bash script that reads each line and execute the otrs.AddCustomerUser.pl script with the variables / input from users.txt I think it wil be something with awk but my brain cant figure it out. I did find lots of scripts that do almost the same, but I just cant find the right way to make it work.
The users.txt file is formated like
firstname[TAB]lastname[TAB]password[TAB]email[TAB]username\n
This is the code I got now, but it's not working.
#!/bin/bash
while read
firstname=$( echo $line | cut -f1 )
lastname=$( echo $line | cut -f2 )
password=$( echo $line | cut -f3 )
email=$( echo $line | cut -f4 )
user=$( echo $line | cut -f5 )
do /opt/otrs/bin/otrs.AddCustomerUser.pl -f $firstname -l $lastname -p $password -e $email -c CUSTOMER $user
done < /root/tabdelimited.csv
cutto extract each field value from each line. Not sure what OTRS provides to check whether a given user exists, though.cut. For example$firstName=$( echo $line | cut -f1 )