From 7a72bc37be3fd02d3ca20b646bf61705334bfcc0 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Mon, 9 Apr 2018 18:37:24 +0200
Subject: [PATCH] small fix

Using completion the config.sh script is called during compilation.
This fix avoids problems when cltools is compiled before config
---
 scripts/config.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/config.sh b/scripts/config.sh
index 1d29c9a64..6218bf502 100755
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -29,7 +29,7 @@ Check if plumed as module colvar active
 # notice that the relative path of config.txt is also
 # hardcoded in a comment written in the log from src/core/PlumedMain.cpp
 # if you change it here, also change it there!
-configfile="$(cat "$PLUMED_ROOT"/src/config/config.txt)"
+configfile="$PLUMED_ROOT"/src/config/config.txt
 
 quiet=no
 list=no
@@ -49,14 +49,14 @@ do
   (--quiet|-q) quiet=yes ;;
   (--version|-v) action=version ;;
   (show)
-    echo "$configfile"
+    cat "$configfile"
     exit 0
     ;;
   (has) action=has ;;
   (module) action=module ;;
   (mpiexec) action=mpiexec ;;
   (makefile_conf)
-    echo "$configfile" | awk '{if($1=="makefile_conf") { gsub("^makefile_conf ",""); print} }'
+    cat "$configfile" | awk '{if($1=="makefile_conf") { gsub("^makefile_conf ",""); print} }'
     exit 0
     ;;
   (*)
@@ -77,7 +77,7 @@ case $action in
   do
   
   ff=$(
-    echo "$configfile" |
+    cat "$configfile" |
     awk -v action="$action" -v check="$check" '{ if($1==action && $2==check){ print $3;exit } }'
   )
   
@@ -96,12 +96,12 @@ case $action in
   exit $retval
  ;;
 (version)
-  long=$(echo "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="long") print $3 }')
-  git=$(echo "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="git") print $3 }')
+  long=$(cat "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="long") print $3 }')
+  git=$(cat "$configfile" | grep -v \# | awk '{ if($1=="version" && $2=="git") print $3 }')
   echo "Version: $long (git: $git)"
  ;;
 (mpiexec)
-  mpi=$(echo "$configfile" | grep -v \# | awk '{ if($1=="mpiexec") print $2 }')
+  mpi=$(cat "$configfile" | grep -v \# | awk '{ if($1=="mpiexec") print $2 }')
   if test -n "$mpi" ; then
     retval=0
     test "$quiet" = no && echo "$mpi"
-- 
GitLab