Mailinglist Archive: opensuse (3397 mails)

< Previous Next >
Re: [SLE] script problem
  • From: Anders Johansson <andjoh@xxxxxxxxxx>
  • Date: Fri, 22 Apr 2005 00:21:30 +0200
  • Message-id: <200504220021.30225.andjoh@xxxxxxxxxx>
On Thursday 21 April 2005 22:11, Chadley Wilson wrote:
> Greetings,
>
> any ideas here would be great,
> I have a situation where our network is entirely dialup, we are sending
> stacks of new computers out and I spend so much time loading them I don't
> get to other tasks,
>
> I want to script the creation of my default configs, the problem is the
> default users on the system,
>
>
> I am currently trying with a for loop:
>
> for i in `awk '{print$1}' autousers`
> do
> useradd -d /u/$i -m -s /bin/sh -p `awk '{print$2}' autousers` $i
> done

That won't work, the seconf awk will basically read from the start of the file
again. You want something like this

#!/bin/bash

while read user password; do
useradd -d /u/$user -m -s /bin/sh -p $password $user
done < autousers

< Previous Next >
Follow Ups
References