extchg.sh and sub-dir

This commit is contained in:
Marc Delisle
2001-07-08 01:49:29 +00:00
parent b5e5ffb676
commit 48997a8ee6
2 changed files with 12 additions and 27 deletions

View File

@@ -11,6 +11,7 @@ $Source$
2001-07-07 Marc Delisle <lem9@users.sourceforge.net> 2001-07-07 Marc Delisle <lem9@users.sourceforge.net>
* bug 439340: do not backquote in grant/revoke, will have to find * bug 439340: do not backquote in grant/revoke, will have to find
the proper way to protect special db names the proper way to protect special db names
* bug 439313 extchg.sh not recursive
2001-07-07 Lo<4C>c Chapeaux <lolo@phpheaven.net> 2001-07-07 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* left.php3: improved the css. * left.php3: improved the css.

View File

@@ -6,38 +6,22 @@
# modified by Tobias Ratschiller to allow any file extension # modified by Tobias Ratschiller to allow any file extension
# part of the phpMyAdmin distribution <http://phpwizard.net/phpMyAdmin> # part of the phpMyAdmin distribution <http://phpwizard.net/phpMyAdmin>
if [$1 eq ""] # 2001-07-07, lem9@users.sourceforge.net:
# - supports sub-directories
# - no more bak directory
if [ $# != 2 ]
then then
echo "Missing first parameter (extension to be changed)" echo "Usage: extchg.sh <extension to change from> <extension to change to>"
echo "Usage: extchg <extension to change from> <extension to change to>" echo ""
echo "Example: extchg.sh php3 php"
exit exit
fi fi
if [$2 eq ""] for i in `find . -name "*.$1"`
then
echo "Missing second parameter (extension to change to)"
echo "Usage: extchg <extension to change from> <extension to change to>"
exit
fi
if test ! -s *.$1
then
echo 'Nothing to convert! Try to copy the script to the directory where you have files to convert.'
exit
fi
if test ! -d bak
then
mkdir bak
else
echo 'Directory bak is already there - will try to use it to backup your files...'
fi
for i in *.$1
do do
echo $i
sed -e 's/'$1'/'$2'/g' $i > `ls $i|sed -e 's/'$1'/'$2'/g'` sed -e 's/'$1'/'$2'/g' $i > `ls $i|sed -e 's/'$1'/'$2'/g'`
mv $i bak/$i rm $i
done; done;