Reputation: 149
I have a file that is filled with Full Names and Username, the file will look like this
Bob Smith bsmith
David Miller dmiller
...
I could do this one at a time by doing:
useradd -c "Bob Smith" -d /home/bsmith -s /bin/bash bsmith
But I want to figure out how to iterate through my file with a while loop and use variables maybe to do this. Thanks!
Upvotes: 0
Views: 52
Reputation: 67497
You can use something like this
$ while read a b c; do echo -e "first: $a \t second: $b \t third: $c"; done << EOF
> Bob Smith bsmith
> David Miller dmiller
> EOF
first: Bob second: Smith third: bsmith
first: David second: Miller third: dmiller
Upvotes: 1