#!/bin/bash
exec < password_file
while read LINE; do
IFS=" "; set -- $(echo $LINE)
MyUserName=$1
MyPassword=$2
MyFullName=$3
MyFullName=$3
useradd "${MyUserName}" -c "${MyFullName}"
echo "${MyPassword}" | passwd "${MyUserName}" --stdin
done
<End Script>
On 5/26/06, Gabriel Briones <[EMAIL PROTECTED]> wrote:
OOppsss my bad, may error sa script :-)
here's the corrected script
<Begin Script>
#!/bin/bash
MyFile=password_file
MyUserName=`cat "${MyFile}" | awk '{print $2}'`MyPassword=`grep ${MyUserName} ${MyFile} | awk '{print $1}'`
MyFullName=`grep ${MyUserName} ${MyFile} | awk '{print $3}'`
useradd "${MyUserName}" -c "${MyFullName}"
echo "${MyPassword}" | passwd "${MyUserName}" --stdin
<End Script>On 5/26/06, Gabriel Briones < [EMAIL PROTECTED]> wrote:Hi,
try this simple script
<Begin Script>
#!/bin/bash
MyFile=password_file
MyUserName=`cat "${MyFile}" | awk '{print $2}'`
MyPassword=`grep ${MyUserName} | awk '{print $1}'`
MyFullName=`grep ${MyUserName} | awk '{print $3}'`
useradd "${MyUserName}" -c "${MyFullName}"
echo "${MyPassword}" | passwd "${MyUserName}" --stdin
<End Script>
just replace password_file with your actual file
Hope this helps
regards,
-jon-On 5/26/06, seekuel < [EMAIL PROTECTED]> wrote:Hi Sirs,
This is the format of the txt document:
-----
password username fullname
-----
--
Keyboard error, press F1 to continue
--
Keyboard error, press F1 to continue
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph
_________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List [email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines: http://linux.org.ph/lists Searchable Archives: http://archives.free.net.ph

