From owner-freebsd-questions Sat Apr 6 12: 6:39 2002 Delivered-To: freebsd-questions@freebsd.org Received: from dns.perimeter.co.za (dns.perimeter.co.za [196.25.164.254]) by hub.freebsd.org (Postfix) with ESMTP id 495CB37B41A for ; Sat, 6 Apr 2002 12:06:30 -0800 (PST) Received: from there (ndf-dial-196-30-223-66.mweb.co.za [196.30.223.66]) by dns.perimeter.co.za (8.11.1/8.11.1) with SMTP id g36K5o518062; Sat, 6 Apr 2002 22:05:52 +0200 (SAST) (envelope-from bsd@perimeter.co.za) Content-Type: text/plain; charset="iso-8859-1" From: "Patrick O'Reilly" Organization: Perimeter Networks CC Message-Id: <200204062205.07871@.perimeter.co.za> To: parv Subject: Re: Redistributing adduser's dotfiles to users Date: Sat, 6 Apr 2002 22:09:22 +0200 X-Mailer: KMail [version 1.3.2] Cc: f-q References: <1018013904.3cada8d0cf171@mail.broadpark.no> <014f01c1dcab$78a608b0$b50d030a@PATRICK> <20020406080531.GB90139@moo.holy.cow> In-Reply-To: <20020406080531.GB90139@moo.holy.cow> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat 06 Apr 02 10:05, parv wrote: > just some minor notes, nothing much (consider '>' to be secondary > shell prompt)... > > % # cat /etc/passwd | cut -d":" -f1 > /tmp/usr-list > > cut -d":" -f1 < /etc/passwd | grep -v '^#' > /tmp/usr-list > > # ...or... > > awk -F':' '! /^#/ { print $1}' < /etc/passwd > /tmp/usr-list > > % # vi /tmp/usr-list (remove any accounts that you don't want to > % affect, like root?) True! I was relying on the user to scrub the rubbish during the "vi" :) > % # cd /home > % # for usr in `ls` > > # no need for backquotes, or ls; use shell globbing > > for usr in * > Actually, I subsequently corrected myself - using `ls` after so carefully preparing /tmp/usr-list was a logic error in my code. I see you fell for it too :) The intended solution was: for usr in `cat /tmp/usr-list` > > % > do > % > echo ${usr} > % > for file in `ls /usr/share/skel` > > > for file in /usr/share/skel/* > > % > do > % > newfile=`echo ${file} | cut -d"." -f2` > % > cp /usr/share/skel/${file} ${usr}/.${newfile} > > # temporary variable "newfile", echo & cut in sub shell can be done > # away with shell parameter expansion > > > do > > cp $file ${usr}/.${file#*.} > This is beyond me - time to go play with it ! > % > done > % > chown -R `grep "^${usr}" /etc/passwd | cut -d":" -f3,4` ${usr} > > well, no change there. my method would have been bit more > complicated. i can't avoid "cut" after all. > > > % > done > > > ...just another way to do somethings. > And so we learn! :) Thanks. Patrick. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message