From owner-freebsd-questions  Sat Apr  6  0: 3:12 2002
Delivered-To: freebsd-questions@freebsd.org
Received: from avocet.prod.itd.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50])
	by hub.freebsd.org (Postfix) with ESMTP id BE19F37B417
	for <freebsd-questions@freebsd.org>; Sat,  6 Apr 2002 00:03:08 -0800 (PST)
Received: from sdn-ar-007dcwashp114.dialsprint.net ([63.178.91.74] helo=moo.holy.cow)
	by avocet.prod.itd.earthlink.net with esmtp (Exim 3.33 #1)
	id 16tlAB-0001a4-00; Sat, 06 Apr 2002 00:03:07 -0800
Received: by moo.holy.cow (Postfix, from userid 1001)
	id 81F6450B8D; Sat,  6 Apr 2002 03:05:31 -0500 (EST)
Date: Sat, 6 Apr 2002 03:05:31 -0500
From: parv <parv@pair.com>
To: Patrick O'Reilly <bsd@perimeter.co.za>
Cc: f-q <freebsd-questions@freebsd.org>
Subject: Re: Redistributing adduser's dotfiles to users
Message-ID: <20020406080531.GB90139@moo.holy.cow>
Mail-Followup-To: Patrick O'Reilly <bsd@perimeter.co.za>,
	f-q <freebsd-questions@freebsd.org>
References: <1018013904.3cada8d0cf171@mail.broadpark.no> <014f01c1dcab$78a608b0$b50d030a@PATRICK>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <014f01c1dcab$78a608b0$b50d030a@PATRICK>
Sender: owner-freebsd-questions@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-questions.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-questions>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-questions>
X-Loop: FreeBSD.ORG

just some minor notes, nothing much (consider '>' to be secondary
shell prompt)...


in message <014f01c1dcab$78a608b0$b50d030a@PATRICK>,
wrote Patrick O'Reilly thusly...
%
% I don't know a utility for this job, but a little command-line scripting
% should be quite easy:
% 
% # 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?)
% # cd /home
% # for usr in `ls`

# no need for backquotes, or ls; use shell globbing

for usr in *


% > 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#*.}


% > 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.

 - parv

-- 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message