[Samba] smbpasswd script fails

Jack Mendez jmendez at vips4kids.org
Fri Dec 2 04:01:50 GMT 2005

my useradd script works exactly the same way, why does that one work and
not this one?
kinda new to awk so just want to learn, i will give this a shot though.

On Thu, December 1, 2005 9:02 pm, Herb Lewis said:
> You are sending all the output to a single bash shell so only one
> command gets executed. You need to figure out a way to execute
> the "awk | bash" for each line of users.csv
> Something like the following should work
> #! /bin/bash
> cat users.csv | while  read ;
> do
> echo $REPLY | awk 'BEGIN {FS=","}{print "smbpasswd -a -s
> "$1"\n"$3"\n"$3"\n"}' | /bin/bash
> done
> Jack Mendez wrote:
>> i am using a script with awk which only works to add the first user from
>> my csv file.
>> when running with out the -s switch the output seems to be correct using
>> echo to test.
>> here is the script
>> #!/bin/bash
>> cat users.csv |awk 'BEGIN {FS=","}{print "echo smbpasswd -a -s
>> "$1"\n"$3"\n"$3"\n"}' |/bin/bash
>> this script successfuly adds the first user.
>> when using the -s switch.
>> when i tried this same script with out the -s switch the output is like
>> this.
>> smbpasswd -a username
>> then bash complains
>> and smbpasswd wants a password
>> it does this for each user twice.
>> dunno
>> any ideas?
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/listinfo/samba

More information about the samba mailing list