From b87563b0dea35fb6dc204d9a38b509f5be124293 Mon Sep 17 00:00:00 2001 From: adrien-matta <a.matta@surrey.ac.uk> Date: Fri, 8 Nov 2013 16:29:37 +0100 Subject: [PATCH] * Replace echo by printf in all the script of NPL to avoid issue with * unrecognize -e option on various linux platform --- NPLib/scripts/buildliblist.sh | 28 ++++++++++++---------------- NPLib/scripts/makefile.sh | 8 ++++---- NPLib/scripts/makefile_detector.sh | 12 ++++++------ 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/NPLib/scripts/buildliblist.sh b/NPLib/scripts/buildliblist.sh index eeddcd728..9cc13c3f9 100755 --- a/NPLib/scripts/buildliblist.sh +++ b/NPLib/scripts/buildliblist.sh @@ -27,18 +27,18 @@ echo " + Creating liblist file....." outfile="liblist" # if output file exists delete it -if [ -e $outfile ] ; then - rm $outfile -fi ; +#if [ -e $outfile ] ; then +# rm $outfile +#fi ; # create output file -echo "#! /bin/bash" >> $outfile -echo "#" >> $outfile -echo "# WARNING:" >> $outfile -echo "# This file is automatically generated when NPLib libraries are built through the make command." >> $outfile -echo "# If you modify this file by hand, changes won't persist the next time you compile NPLib." >> $outfile -echo "#" >> $outfile -echo "echo -L$NPTOOL/NPLib/lib \\" >> $outfile +printf "#! /bin/bash\n" > $outfile +printf "#\n" >> $outfile +printf "# WARNING:\n" >> $outfile +printf "# This file is automatically generated when NPLib libraries are built through the make command.\n" >> $outfile +printf "# If you modify this file by hand, changes won't persist the next time you compile NPLib.\n" >> $outfile +printf "#\n" >> $outfile +printf "echo -L$NPTOOL/NPLib/lib" >> $outfile chmod a+x $outfile # loop on *.so files in lib/ directory @@ -48,11 +48,7 @@ do # remove .so extension name=${file%\.*} # replace "lib/lib" pattern by "-l" - name=$(echo $name | sed -e "s/lib\/lib/-l/g") - # add trailing \ - name="$name \\" - # add tab at the beginning - name=$(echo "\011 $name") - echo "\011 $name" >> $outfile + name=$(printf $name | sed -e "s/lib\/lib/-l/g") + printf " $name " >> $outfile fi ; done diff --git a/NPLib/scripts/makefile.sh b/NPLib/scripts/makefile.sh index 8a2120d1e..21c6f7b66 100755 --- a/NPLib/scripts/makefile.sh +++ b/NPLib/scripts/makefile.sh @@ -27,9 +27,9 @@ #! /bin/bash if [ $# = 0 ] ; then - echo " + Building detector libraries....." + printf " + Building detector libraries.....\n" else - echo " + Cleaning $2 libraries....." + printf " + Cleaning $2 libraries.....\n" fi ; # read .detector_libs or .core_libs file created by the configure script @@ -47,9 +47,9 @@ do # file name in lower case lname=$(echo "$name" | tr '[A-Z]' '[a-z]') # only build defined detector libraries - if echo "$detectorlibs" | grep -q "$lname" ; then + if printf "$detectorlibs" | grep -q "$lname" ; then # print informations - echo "\011Entering $name directory..." + printf "\tEntering $name directory...\n" # add "-C ./" pattern at the beginning of the name cmd="-C ./$name" # execute make command with target specified on command line diff --git a/NPLib/scripts/makefile_detector.sh b/NPLib/scripts/makefile_detector.sh index 9c650d3b6..814a766ca 100755 --- a/NPLib/scripts/makefile_detector.sh +++ b/NPLib/scripts/makefile_detector.sh @@ -28,19 +28,19 @@ # build message -echo -e "\t@echo \"Entering $1 directory...\"" >> $2 +printf "\t@echo \"Entering $1 directory...\"" >> $2 # execute make command with target specified on command line -echo -e "\tmake --silent -C ./$1" >> $2 +printf "\tmake --silent -C ./$1" >> $2 # copy header files -echo -e "\tcd $1; cp -f *.h ../include" >> $2 +printf "\tcd $1; cp -f *.h ../include" >> $2 # remove *Dict header files -echo -e "\tcd include; rm *Dict.h" >> $2 +printf "\tcd include; rm *Dict.h" >> $2 # copy library files -echo -e "\tcd $1; cp -f *.so ../lib" >> $2 +printf "\tcd $1; cp -f *.so ../lib" >> $2 # deal with mac osx dylib files #echo "ifeq (\$(findstring macosx, \$(ARCH)), macosx)" >> $2 #echo "\t@echo \"to be done\"" #echo "endif" >> $2 # newline -echo "" >> $2 +printf "" >> $2 -- GitLab