im trying to use a for loop inside an expect script. the objectve of the script is to add a user with password but i need to use a certain file of names to do so. The file consists of 100 names first and last.
Code:
#!/bin/bash
if [$# -ne 4]; then
echo "Usage: Username group Firstname lastname";
exit;
fi
user = ${1};
gid = ${2};
fname = ${3};
lname = ${4};
useradd -c "$fname $lname" -g $gid $user;
is there any way to make a for loop to use a certain file of names so fname and lname are taken from the file and it would just go down the list? (this is just a section of my code and i want to eventually do this for group and user but i just wanted to start small)