bsnipes n00b
Joined: 30 May 2002 Posts: 37
|
Posted: Fri Mar 07, 2003 7:20 pm Post subject: Scripts I find useful for ._cfg* file updating |
|
|
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
Brian |
|