Re: Copying the same file to multiple directories
From: Jean-Pierre Radley (jpr_at_jpr.com)
Date: 07/01/03
- Next message: Doug Luurs: "SCO OSR 5.0.7 and a Onstream ADR2SR"
- Previous message: Michael Sweeden: "Re: What typically causes system panics in 5.0.4?"
- In reply to: Nachman Yaakov Ziskind: "Copying the same file to multiple directories"
- Next in thread: Nachman Yaakov Ziskind: "Re: Copying the same file to multiple directories"
- Reply: Nachman Yaakov Ziskind: "Re: Copying the same file to multiple directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 1 Jul 2003 13:44:28 -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
- Next message: Doug Luurs: "SCO OSR 5.0.7 and a Onstream ADR2SR"
- Previous message: Michael Sweeden: "Re: What typically causes system panics in 5.0.4?"
- In reply to: Nachman Yaakov Ziskind: "Copying the same file to multiple directories"
- Next in thread: Nachman Yaakov Ziskind: "Re: Copying the same file to multiple directories"
- Reply: Nachman Yaakov Ziskind: "Re: Copying the same file to multiple directories"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|