Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Scripts I find useful for ._cfg* file updating
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
bsnipes
n00b
n00b


Joined: 30 May 2002
Posts: 37

PostPosted: Fri Mar 07, 2003 7:20 pm    Post subject: Scripts I find useful for ._cfg* file updating Reply with quote

I just thought I would share a couple of bash scripts that I wrote that help me to quickly move the ._cfg* files to the primary position. They don't do anything fancy like merging but for a simple find and replace it is quick. Of course you should be careful and make sure you know what files are being replaced before using these.
The first is a simple cfgfind file (I put it in /usr/sbin as cfgfind and mark executable). If you execute it as 'cfgfind' it shows all files in need of updating in the current directory and below. You can optionally use it with a parameter like 'cfgfind /usr/X11r6' or 'cfgfind /etc' to have it list the files in need of updating in an alternate directory.
Code:

#!/bin/bash
if test -z "$1"
then
  find ./ -name "._cfg*"
else
  find $1 -name "._cfg*"
fi


The second script I call cfgupdate. Again I put it in /usr/sbin and name it cfgupdate. Mark it executable also. What it does is mv the ._cfg* files to replace the original file. I use it ALOT in places like /etc/init.d and /etc/skel . Just cd into the directory then run 'cfgupdate'.
Code:

#!/bin/bash
for i in `ls ._cfg*`
do
  NEW=`echo $i | cut -d_ -f3-`
  mv $i $NEW
done


These work for me but use them at your own risk 8O

Brian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum