Don't read and write to the same file and using cat with
sed is redundant, replace these lines:
Code:
cat $i | sed -e "s/login\//login.tst\//" > $i
cat $i | sed -e "s/cyberkd\//cyberkd.tst\//" > $i
cat $i | sed -e "s/\/db_connect.inc.php/\/testdb_connect.inc.php/" > $i
with:
Code:
sed -e "s/login\//login.tst\//" -e "s/cyberkd\//cyberkd.tst\//" -e "s/\/db_connect.inc.php/\/testdb_connect.inc.php/" "$1" > temp.file
mv temp.file "$1"
If you're
sed version supports the -i flag you can edit the file in place without using a temporary file.
Code:
sed -i -e "s/login\//login.tst\//" -e "s/cyberkd\//cyberkd.tst\//" -e "s/\/db_connect.inc.php/\/testdb_connect.inc.php/" "$1"
Regards