source:
trunk/NEMOGCM/TOOLS/COMPILE/Fclean_config.sh
@
3354
Last change on this file since 3354 was 3294, checked in by rblod, 12 years ago | |
---|---|
|
|
File size: 1.8 KB |
Rev | Line | |
---|---|---|
[2301] | 1 | #!/bin/bash |
2 | ###################################################### | |
3 | # Author : Simona Flavoni for NEMO | |
4 | # Contact : sflod@locean-ipsl.upmc.fr | |
5 | # | |
[2359] | 6 | # Some functions called from makenemo |
[2301] | 7 | # Fclean_config : config removing |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
15 | # ================ | |
16 | # Fclean_config.sh | |
17 | # ================ | |
18 | # | |
[2520] | 19 | # ------------------------ |
[2301] | 20 | # Remove the configuration |
[2520] | 21 | # ------------------------ |
[2301] | 22 | # |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
28 | # $ Fclean_config.sh CONFNAME | |
29 | # | |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
35 | # Remove the configuration: | |
36 | # | |
[2520] | 37 | # - remove CONFIG_NAME/WORK |
38 | # - remove CONFIG_NAME/BLD | |
39 | # - remove CONFIG_NAME from TOOLS/TOOLS/COMPILE/cfg.txt | |
40 | # | |
[2301] | 41 | # EXAMPLES |
42 | # ======== | |
43 | # | |
44 | # :: | |
45 | # | |
[2520] | 46 | # $ ./Fclean_config.sh ORCA2_LIM |
[2301] | 47 | # |
48 | # | |
49 | # TODO | |
50 | # ==== | |
51 | # | |
52 | # option debug | |
53 | # | |
54 | # | |
55 | # EVOLUTIONS | |
56 | # ========== | |
57 | # | |
58 | # $Id: Fclean_config.sh 2158 2010-10-20 17:30:03Z sflod $ | |
59 | # | |
60 | # | |
61 | # | |
62 | # * creation | |
63 | # | |
64 | #- | |
65 | NEW_CONF=${x_n} | |
[3294] | 66 | if [ ${#NEW_CONF} -eq 0 ] ; then |
67 | echo " " | |
68 | echo "No configuration specified, please use makenemo -n CONFIG clean_config " | |
69 | else | |
70 | echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] " | |
71 | read answer | |
72 | answer=`echo $answer | sed 's/^[y].*$/y/'` | |
73 | if [ -z "$answer" -o "x$answer" = "xy" ]; then | |
74 | # testing if configuration exists | |
75 | if [ "$(cat ${CONFIG_DIR}/cfg.txt | grep "${NEW_CONF} ")" == "" ] ; then | |
76 | echo "The configuration ${NEW_CONF} does not exist in file cfg.txt" | |
77 | echo "No removing configuration" | |
78 | echo " " | |
[2301] | 79 | else |
[3294] | 80 | rm -rf ${CONFIG_DIR}/${NEW_CONF} |
81 | sed -e "/${NEW_CONF} /d" ${CONFIG_DIR}/cfg.txt > ${CONFIG_DIR}/cfg.tmp | |
82 | mv ${CONFIG_DIR}/cfg.tmp ${CONFIG_DIR}/cfg.txt | |
83 | echo "${NEW_CONF} configuration REMOVED" | |
[2301] | 84 | fi |
[3294] | 85 | else |
86 | echo " " | |
87 | echo "nothing to remove" | |
88 | fi | |
89 | fi | |
[2301] | 90 | unset -v answer |
Note: See TracBrowser
for help on using the repository browser.