-
Notifications
You must be signed in to change notification settings - Fork 0
/
path_change
executable file
·35 lines (35 loc) · 949 Bytes
/
path_change
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
unalias -a
echo
echo " path_change (Version December 29 2023) (C) Copyright 2023 Arjan Koning All Rights Reserved"
echo
#
# Script to change the code directory in machine.f or machine.f90
#
# Set user
#
user='Arjan Koning'
#
# Ensure that the code directory is changed by replacing
# the path name in subroutine machine.f or machine.f90
#
codedir=`pwd`'/'
if [ -e machine.f ] ; then
ffile=machine.f
fi
if [ -e machine.f90 ] ; then
ffile=machine.f90
fi
if [ -e $ffile ] ; then
sed "s/ user =.*/ user = '${user}'/" $ffile > tmp
mv -f tmp $ffile
echo "Do not forget to change the 'user' variable in the path_change script by your own name "
echo 'Right now it is: ' $user
echo
newdir=`echo $codedir | sed 's/\//\\\\\//g' | sed 's/source.*$//g'`
sed "s/ codedir.*/ codedir = '${newdir}'/" $ffile > tmp
mv -f tmp $ffile
echo 'Replaced code directory in ' $ffile' by:'
grep ' codedir =' $ffile
echo
fi