Re: Copying the same file to multiple directories
From: Nachman Yaakov Ziskind (awacs_at_egps.com)
Date: 07/01/03
- Next message: Bob Bailin: "Re: Merge 5.3 and older DOS"
- Previous message: Doug Luurs: "SCO OSR 5.0.7 and a Onstream ADR2SR"
- In reply to: Jean-Pierre Radley: "Re: Copying the same file to multiple directories"
- Next in thread: Bill Vermillion: "Re: Copying the same file to multiple directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
- Next message: Bob Bailin: "Re: Merge 5.3 and older DOS"
- Previous message: Doug Luurs: "SCO OSR 5.0.7 and a Onstream ADR2SR"
- In reply to: Jean-Pierre Radley: "Re: Copying the same file to multiple directories"
- Next in thread: Bill Vermillion: "Re: Copying the same file to multiple directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|