Skip to content

Commit

Permalink
SwitchDest script
Browse files Browse the repository at this point in the history
  • Loading branch information
unicfdlab committed Apr 8, 2020
1 parent 1baf5a8 commit 194ebd9
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions SwitchDest
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
#
# Use this script to switch destination of compiled
# OpenFOAM sources in all folder descent to this one:
# - to swith destination to FOAM_APPBIN and FOAM_LIBBIN run:
# ./SwitchDest
# - to switch desctination to FOAM_USER_APPBIN and FOAM_USER_LIBBIN run:
# ./SwitchDest USER
#

export FROM="FOAM_USER"
export TO="FOAM"

if [ "$1" = "USER" ]
then
FROM="FOAM"
TO="FOAM_USER"
fi

changeDist()
{
local locDIR=$1
cd $locDIR
local locFILES=`ls .`
for locF in $locFILES
do
if [ -d $locF ]
then
if [ "$locF" = "Make" ]
then
echo $locDIR
sed -i "s/$FROM/$TO/g" Make/options
sed -i "s/$FROM/$TO/g" Make/files
else
changeDist $locF
fi
fi
done
cd ../
}

changeDist $PWD

#
#END-OF-FILE
#


0 comments on commit 194ebd9

Please sign in to comment.