2 # Copyright (C) 2006-2016 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 echo " renameSalomeModule oldName newName dirModule"
27 echo " -> replace any occurence of oldName by newName in module dirModule"
29 echo " (nex name cannot contain old name)"
33 echo " cp -r HELLO_SRC CALCULATOR_SRC"
34 echo " renameSalomeModule HELLO CALCULATOR CALCULATOR_SRC"
41 # Rename the first directory containing $oldName in their file name
42 liste=`find . -type d -name "*${oldName}*"`
45 newFile=`echo $file | sed "s/${oldName}/${newName}/g"`
46 echo "mv -f $file $newFile"
73 # check names for restriction
74 echo $newName | grep $oldName > /dev/null
77 echo -e "Sorry : There is a restriction!\nNew name cannot contain old name.\n"
84 if [ "$1" == "-i" ] # mode interactif
86 echo replace any occurence of $oldName by $newName in module $moduleName
89 echo "Do you want to replace any occurence of $oldName by $newName in module $moduleName ?"
94 y* | Y* | o* | O* ) ;;
101 echo Renamed Directories:
104 # rename directories one by one
111 # rename files containing ${oldName} in their name
115 liste=`find . -name "*${oldName}*"`
118 newFile=`echo $file | sed "s/${oldName}/${newName}/g"`
119 echo "mv -f $file $newFile"
126 # modify all files containing $oldName, replace occurences by $newName
127 liste=`find -name "*"`
132 grep $oldName $file > /dev/null 2>&1
136 cat $file | sed "s/${oldName}/${newName}/g" > fic_temp_${today}
137 cp -f fic_temp_${today} $file
141 rm -f fic_temp_${today}