source: CONFIG/UNIFORM/v6/propagate_master_config.ksh @ 3055

Last change on this file since 3055 was 3055, checked in by jgipsl, 4 years ago

Changed greenhouse gazes to use new CMIP6 forcing files. Note the file SOLARANDVOLCANOES.txt is still kept with the CMIP5 values. This file is only used for the case with old physics, when ok_suntime_rrtm=n.

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/bin/ksh
2#set -xv
3#
4# Use this script to propagated modifcations done to files in one configuration
5# into the all other configurations in the same directory. Files will be copied
6# only where they already exist.
7#
8# Syntax :
9# ./propagate_master_config MyConfig
10# Modifcations in MyConfig will be copied to the other configurations.
11
12# Josefine Ghattas IPSL
13
14if [ $# == 0 ] ; then
15    echo "You need to specify the configuration from which the modifications will be propagted"
16    echo "./propagate_master_config MyConfig"
17    exit
18fi
19
20MasterConfig=$1
21verbose=yes
22BaseDir=`pwd`
23ConfigFamily=v6
24ConfigList=`ls |grep ${ConfigFamily} |grep -v out`
25ConfigList=$ConfigList" IPSLCM6" 
26ConfigList="IPSLCM6 LMDZOR_v6" 
27echo  All modifications in configuration $MasterConfig will copied to the other configurations $ConfigList .
28
29cd $BaseDir/$MasterConfig
30FileList=`ls -d GENERAL/DRIVER/* GENERAL/PARAM/* GENERAL/POST/* EXPERIMENTS/*/*/* EXPERIMENTS/*/*/*/*`
31
32cpfile=$BaseDir/cpfile
33
34echo "" > $cpfile
35cd $BaseDir
36
37for conf in $ConfigList ; do
38    # Only contiue if the config is not the MasterConfig
39    if [ $conf != $MasterConfig ] ; then
40        echo Do for conf= $conf and MasterConfig=$MasterConfig
41        for file in $FileList ; do
42            if [ -f ${conf}/${file} ] ; then
43                cmp -s ${MasterConfig}/${file}  ${conf}/${file}
44                if [ $? -ne 0 ] ; then
45                    # Files are differents
46                    echo "cp ${MasterConfig}/${file} ${conf}/${file}" >> $cpfile
47                    if [ $verbose == yes ] ; then
48                        diff  --brief ${MasterConfig}/${file}  ${conf}/${file}
49                        diff  ${MasterConfig}/${file}  ${conf}/${file}
50                    fi     
51                fi
52            fi
53        done
54        echo "" >> $cpfile
55    fi
56done
57
58# Test if there is nothing to copy
59if [ $( grep cp $cpfile |wc -l ) -eq 0 ] ; then
60    echo "Noting to be done. All files are the same."
61    rm $cpfile
62    exit
63fi
64
65# List files to copy and ask for permission to copy
66echo ""
67cat $cpfile
68
69echo "Would you like to do the actions listed above, answer yes/no ?"
70echo -n " Your answer : "
71read answer
72
73case ${answer} in
74yes|y)
75chmod +x $cpfile
76$cpfile
77echo "Copy has now been done."
78;;
79no|n)
80echo "Nothing will be done"
81;;
82*)
83echo "Bad answer. Nothing will be dnoe"
84;;
85esac
86rm $cpfile
87
88exit
Note: See TracBrowser for help on using the repository browser.