I have a dat file with names. These are the names of users I must add, without groups or passwords. Ofcourse i have to remove all spaces. I have to add them with a bash script. Can anyone help me write the script?
File:
Marianne Earman
Justina Dragaj
Mandy Mcdonnell
Conrad Lanfear
Cyril Behen
Shelley Groden
Rosalind Krenzke
Davis Brevard
Winnie Reich
Trudy Worlds
Deshawn Inafuku
Claudio Loose
Sal Pindell
Cristina Sharper
Tricia Kruss
My script:
#!/bin/bash
#users.dat | sed "s/\t\t*/ /g"
while read p; do
#var=$(echo $p | sed "s/\t\t*/ /g")
var= echo $p | sed '/^$/d;s/[[:blank:]]//g'
#sudo useradd $var
sudo useradd $var
done < users.dat
#!/bin/bash
if [$# -ne 0 ] then echo "usage: $0 < file' exit 1 fi
first=cut -f 1 -d ',' user_list
usern=$first| tr 'A-Z' 'a-z'
while read line; do echo "adding $usern\n" done < users.dat
– user64047 Mar 31 '14 at 17:24