Last change
on this file since 4400 was
1605,
checked in by Ehouarn Millour, 13 years ago
|
Fixed problematic if/elif sequence in "makdim" script. Also did some cleanup and added some tests and comments.
EM
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.5 KB
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | #set -xv |
---|
3 | |
---|
4 | # sanity check: do we have the required argument ? |
---|
5 | if (( $# < 1 )) || (( $# > 3 )) |
---|
6 | then |
---|
7 | echo "Wrong number of parameters in $0 !!!" |
---|
8 | echo " Usage:" |
---|
9 | echo " $0 [im] [jm] lm" |
---|
10 | echo " where im, jm and lm are the dimensions" |
---|
11 | exit |
---|
12 | fi |
---|
13 | |
---|
14 | # build "fichnom", the relevant 'dimensions.im.jm.lm' file name |
---|
15 | for i in $* |
---|
16 | do |
---|
17 | list=$list.$i |
---|
18 | done |
---|
19 | fichdim=dimensions${list} |
---|
20 | |
---|
21 | if [ ! -f $fichdim ] |
---|
22 | then |
---|
23 | # echo "$fichdim does not exist" |
---|
24 | |
---|
25 | # assign values of im, jm and lm |
---|
26 | if [ $# -ge 3 ] |
---|
27 | then |
---|
28 | im=$1 |
---|
29 | jm=$2 |
---|
30 | lm=$3 |
---|
31 | ndm=1 |
---|
32 | elif [ $# -ge 2 ] |
---|
33 | then |
---|
34 | im=1 |
---|
35 | jm=$1 |
---|
36 | lm=$2 |
---|
37 | ndm=1 |
---|
38 | elif [ $# -ge 1 ] |
---|
39 | then |
---|
40 | im=1 |
---|
41 | jm=1 |
---|
42 | lm=$1 |
---|
43 | ndm=1 |
---|
44 | fi |
---|
45 | |
---|
46 | # since the file doesn't exist, we create it |
---|
47 | cat << EOF > $fichdim |
---|
48 | !----------------------------------------------------------------------- |
---|
49 | ! INCLUDE 'dimensions.h' |
---|
50 | ! |
---|
51 | ! dimensions.h contient les dimensions du modele |
---|
52 | ! ndm est tel que iim=2**ndm |
---|
53 | !----------------------------------------------------------------------- |
---|
54 | |
---|
55 | INTEGER iim,jjm,llm,ndm |
---|
56 | |
---|
57 | PARAMETER (iim= $im,jjm=$jm,llm=$lm,ndm=$ndm) |
---|
58 | |
---|
59 | !----------------------------------------------------------------------- |
---|
60 | EOF |
---|
61 | |
---|
62 | fi |
---|
63 | |
---|
64 | # remove 'old' dimensions.h file (if any) and replace it with new one |
---|
65 | if [ -f ../dimensions.h ] ; then |
---|
66 | \rm ../dimensions.h |
---|
67 | fi |
---|
68 | tar cf - $fichdim | ( cd .. ; tar xf - ; mv $fichdim dimensions.h ) |
---|
69 | # line above is a trick to preserve time of creation of dimensions.h files |
---|
Note: See
TracBrowser
for help on using the repository browser.