Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line change in .profile for many users

Status
Not open for further replies.

mbach

Technical User
Dec 12, 2000
24
US
All,
I need to change a line in everyone's .profile on a server.
I need to change . /dir/dir/fileA to . /dir/dir/fileB in /home/*/.profile
I am leaning towards the find...exec command.
Thanx,
Mike B.
 
If it is possible you could put this line into /etc/profile which is executed for all users before .profile.



hnd
hasso55@yahoo.com

 
mbach

You could also delete file A and create a new file A which is a link to file B (presuming you dont need file A anymore).
 
best thing to do is probably put
the line in /etc/profile like hnd
said. but just if you want to know
how else it might be done ....

something like this maybe

#!/bin/sh
for file in /home/*/.profile
do
sed s|fileA|fileB|g $file > tmp
mv tmp $file
done


it might work ... im not used to writing shell
scripts so anyone feel free to criticise :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top