Shell script

Brian Densmore DensmoreB at ctbsonline.com
Wed Nov 12 19:58:39 CST 2003


Try this to change the password

 #!/bin/bash
 while read ALINE
 do
 IFS=|
 set -- ALINE
 /usr/bin/passwd $1 --stdin $2
 done

> -----Original Message-----
> From: brad [mailto:brad at bradandkim.net]
> Sent: Wednesday, November 12, 2003 10:01 AM
> To: kclug at kclug.org
> Subject: Re: Shell script
> 
> 
> Hmmm....same thing.  I was trying to send useradd the flags 
> -g, -d, and
> -s, so I trimmed it down to just plain old /usr/sbin/useradd $1 and I
> get the same thing.  Since I can run my whole useradd line 
> manually (of
> course replacing the variable with a real username) and it 
> runs fine, I
> don't think my usage is off.  I still think it is having 
> trouble picking
> up the variable.  Again, just echoing $1 provides nothing.  I 
> will keep
> digging.
> 
> Thanks,
> 
> Brad
> 
> 
> Scott wrote:
> > Let me give the script to you again....  I think it's just a typo...
> > 
> > #!/bin/sh
> > while read ALINE
> > do
> > IFS=|
> > set ALINE
> > /usr/sbin/useradd -c "$1 Account Whatever Comment Here" $1
> > echo $2 | /usr/bin/passwd --stdin $1
> > done
> > 
> > 
> > That aught to get it for you....
> > 
> > scottm
> 
> 
> 
> 
> majordomo at kclug.org
> 




More information about the Kclug mailing list