gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 535fc5a6: astscript-sort-by-night: properly or


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 535fc5a6: astscript-sort-by-night: properly ordered input argument names
Date: Sat, 19 Mar 2022 14:39:27 -0400 (EDT)

branch: master
commit 535fc5a64ec4fa63e874d2ef073f5a3977a3a887
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    astscript-sort-by-night: properly ordered input argument names
    
    Until now, when given multiple files, through the 'inputs="$1 $inputs"'
    expression, this script would effectively reverse their order for later
    steps! Also, if there was a single argument, it would put an extra SPACE
    before it.
    
    With this commit, the standard check (that was recently added to other
    scripts) has been added to make sure that the order is correct, and that
    there isn't any extra SPACE before a single input.
---
 bin/script/sort-by-night.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/script/sort-by-night.in b/bin/script/sort-by-night.in
index 27837cf0..97f21792 100644
--- a/bin/script/sort-by-night.in
+++ b/bin/script/sort-by-night.in
@@ -182,6 +182,7 @@ EOF
 #   if a value is appended to the short format it should crash. So in the
 #   second test for these ('-l*') will account for both the case where we
 #   have an equal sign and where we don't.
+inputs=""
 while [ $# -gt 0 ]
 do
     case "$1" in
@@ -224,7 +225,7 @@ do
 
         # Not an option (not starting with a '-'): assumed to be input FITS
         # file name.
-        *) inputs="$1 $inputs"; shift;;
+        *) if [ x"$inputs" = x ]; then inputs="$1"; else inputs="$inputs $1"; 
fi; shift;;
     esac
 done
 



reply via email to

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