Re: Copying the same file to multiple directories

From: Nachman Yaakov Ziskind (awacs_at_egps.com)
Date: 07/01/03


Date: 1 Jul 2003 15:10:05 -0400

Jean-Pierre Radley wrote (on Tue, Jul 01, 2003 at 01:44:28PM -0400):
> Nachman Yaakov Ziskind typed (on Tue, Jul 01, 2003 at 04:34:13PM +0000):
> | ... say I wanted to copy a file, call it "welcome", to every user's home
> | directory. I know that all the folders live in /usr; thus /usr/first,
> | /usr/second, ... /usr/thousand-and-twenty-two, ...
> |
> | IOW, I want to automate:
> |
> | $ cd /usr
> | $ cp /path-to-welcome first
> | $ cp /path-to-welcome second
> | $ cp /path-to-welcome third
> | $ cp /path-to-welcome fourth
> |
> | etc.
> |
> | What's the nicest/easiest way to do this? SCO 506.
>
>
> #!/bin/ksh
> for D in `awk -F: '$3 >= 200 { print $6 }' /etc/passwd`
> do
> [[ -f $D/.profile || -f $D/.login ]] && cp /path-to-welcome $D
> done
>
> Slight aside: 5.0.7 does not place users in /usr by default, but in /u.
> Take the trouble to move them all there now, it will make your eventual
> upgrade far less annoying. The script I just wrote gives you the bare
> bones for another script to both edit /etc/passwd and move the home
> directories.
>
> --
> JP

Ouch. JP, I'm sorry you took the users thing too literally; actually I'm
copying the file to a bunch of randomly named subdirectories and therefore,
using /etc/passwd will not work :-)

Parenthetically, we have users (migrated from 3.2v4.2, migrated from
Xenix ...) with UIDs less than 200.

Very sorry for the confusion; I thought that modeling the users' home
directory would make things more clear, not less. :-(

-- 
_________________________________________
Nachman Yaakov Ziskind, EA, LLM         awacs@egps.com
Attorney and Counselor-at-Law           http://yankel.com
Economic Group Pension Services         http://egps.com
Actuaries and Employee Benefit Consultants


Relevant Pages

  • Re: System wont boot - missing C:WindowsSystem32System ?
    ... (I did get a RunTime error message at reboot -immediately after the backup- but my system seems to be running ok.) ... The Autoback module could be easier, for those of us who know enough to get into trouble, but have trouble getting out of it. ... I'll Automate it -and hotkey it- with "Automate" and use NTFS for DOS to restore. ...
    (microsoft.public.windowsxp.general)
  • Re: [PATCH 16/16] fix handling of integer constant expressions
    ... poisoning _IOW() et.al., so those who do something like ... run into trouble. ... that gcc has unfixed bugs in that area. ...
    (Linux-Kernel)
  • Re: Copying the same file to multiple directories
    ... > IOW, I want to automate: ... > What's the nicest/easiest way to do this? ... SCO 506. ...
    (comp.unix.sco.misc)
  • Re: is there an easy way to create variables from
    ... Mike wrote: ... trouble, I put them all in a params struct variable. ... automate this process? ... is there an automated approach for the reverse ...
    (comp.soft-sys.matlab)
  • Re: Automation
    ... > I am trying to automate a game with VB.NET but I am having trouble doing ... Prev by Date: ...
    (microsoft.public.vb.com)