On Mon, 2003-06-09 at 19:25, Mark Williamson wrote:
> Hi Kwan,
>
> Nice looking script, but did you try it? But it seems to have problems,
> getting the fields mixed up..
>
Nope, just wrote it on the spot.. Sorry...
Lemme see..Try this...
#!/bin/bash
# kwan:x:500:1000:Kwan Lowe:/home/kwan:/bin/bash
IFS=$'\n'
for item in `cat /etc/passwd`; do
USERNAME=`echo $item | cut -d: -f1`
USERID=`echo $item | cut -d: -f3`
GROUPID=`echo $item | cut -d: -f4`
COMMENT=`echo $item | cut -d: -f5`
USERDIR=`echo $item | cut -d: -f6`
USERSHL=`echo $item | cut -d: -f7`
echo useradd -u ${USERID} -g ${GROUPID} -c ${COMMENT} \
-d ${USERDIR} -s ${USERSHL}
${USERNAME}
done
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com