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> In-Reply-To: <014f01c1dcab$78a608b0$b50d030a@PATRICK> References: <1018013904.3cada8d0cf171@mail.broadpark.no> <014f01c1dcab$78a608b0$b50d030a@PATRICK>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020406080531.GB90139>
