gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 0b9d8f0: Allow spaces for directory values in


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 0b9d8f0: Allow spaces for directory values in during-dev.sh
Date: Thu, 11 Aug 2016 10:15:38 +0000 (UTC)

branch: master
commit 0b9d8f0e4a28c82046f4041933d6989c7ca3e046
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Allow spaces for directory values in during-dev.sh
    
    The directory variables in `tests/during-dev.sh' script might have space
    characters between them. This will cause problems in the subsequent steps
    of this script. So all such variables are now put in quotation marks to fix
    the issue.
---
 tests/during-dev.sh |   36 ++++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/tests/during-dev.sh b/tests/during-dev.sh
index 1195c89..84ba39e 100755
--- a/tests/during-dev.sh
+++ b/tests/during-dev.sh
@@ -66,12 +66,19 @@
 # directory, then set `builddir' to `./'. If you want the outputs to be in
 # the top source directory, set it to `./'. Since 'build' is the assumed
 # symbolic link in `tmpfs-config-make', it is also assumed in the version
-# controlled version of this script.
+# controlled version of this script. Note, if your directory names have
+# space characters in them, quote the full value
 builddir=build
 outdir=
 
 
-# Set the utility name, along with its arguments and options.
+# Set the utility name, along with its arguments and options. NOTE, for
+# multiple arguments and options, please put them all between quotation
+# marks so the space characters are included. If there are spaces in the
+# values of the options or arguments, quote them two times (once for this
+# script, and once for the utility. In such cases it might be easier to
+# just add the argument/option to the final script that runs the utility
+# rather than these variables.
 utilname=
 arguments=
 options=
@@ -86,9 +93,9 @@ options=
 # First, make sure the variables are set. Note that arguments and options
 # are not absolutly vital! so they are not checked here. The utility will
 # warn and halt if it needs them.
-if [ x$outdir = x ];   then echo "outdir is not set.";   exit 1; fi
-if [ x$builddir = x ]; then echo "builddir is not set."; exit 1; fi
-if [ x$utilname = x ]; then echo "utilname is not set."; exit 1; fi
+if [ x"$outdir" = x ];   then echo "outdir is not set.";   exit 1; fi
+if [ x$utilname = x ];   then echo "utilname is not set."; exit 1; fi
+if [ x"$builddir" = x ]; then echo "builddir is not set."; exit 1; fi
 
 
 # If builddir is relative, then append the current directory to make it
@@ -96,16 +103,17 @@ if [ x$utilname = x ]; then echo "utilname is not set."; 
exit 1; fi
 # for executing the utility and we need to know the absolute address of the
 # top build directory.
 if [ ! "${builddir:0:1}" = "/" ]; then
-   builddir=$(pwd)/$builddir
+   builddir=$(pwd)"/$builddir"
 fi
 
 
 # Set the utility's executable file name
-utility=$builddir/src/$utilname/ast$utilname
+utility="$builddir/src/$utilname/ast$utilname"
 
 
-# If the utility is already built, then remove the executable.
-if [ -f $utility ]; then rm $utility; fi
+# If the utility is already built, then remove the executable so it is
+# definitely remade.
+if [ -f "$utility" ]; then rm "$utility"; fi
 
 
 # Make Gnuastro (note that during development, it is sometimes necessary to
@@ -113,7 +121,11 @@ if [ -f $utility ]; then rm $utility; fi
 # the output directory and run the utility with the given arguments and
 # options.
 curdir=$(pwd)
-if make -C $builddir; then
-    cd $outdir
-    $utility $arguments $options
+if make -C "$builddir"; then
+
+    # Change to the output directory.
+    cd "$outdir"
+
+    # Run the built utility with the given arguments and options.
+    "$utility" $arguments $options
 fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]