summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Infante-Sainz <infantesainz@gmail.com>2023-12-14 09:14:27 +0100
committerRaul Infante-Sainz <infantesainz@gmail.com>2023-12-14 09:14:27 +0100
commit4d3b55a28b60ddf0ace3b6f469de9c1695c1e66f (patch)
treec9c5de1515d46bcc0c15a30bcc7b5ccd8cc445b7
parent5e6d069f76d3de7496ba174be32e22488fe2d111 (diff)
downloadgnuastro-4d3b55a28.tar.gz
astscript-fits-view: not accounting for different HDUs bug fixed
Until this commit, this script was not able to account for different HDUs. It only considered the last HDU provided from the command line. With this commit, this bug has been fixed. Now when specifying different HDU numbers or names, they are properly accounted for. This fixes bug #64825, reported by Teet Kuutma: https://savannah.gnu.org/bugs/?64825
-rw-r--r--bin/script/fits-view.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/bin/script/fits-view.sh b/bin/script/fits-view.sh
index fac079e..b3b63a7 100644
--- a/bin/script/fits-view.sh
+++ b/bin/script/fits-view.sh
@@ -8,6 +8,7 @@
# Mohammad Akhlaghi <mohammad@akhlaghi.org>
# All author(s):
# Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Raul Infante-Sainz <infantesainz@gmail.com>
# Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
# Copyright (C) 2020-2023 Free Software Foundation, Inc.
#
@@ -191,9 +192,9 @@ do
case "$1" in
# Input options
- -h|--hdu) hdu="$2"; check_v "$1" "$hdu"; shift;shift;;
- -h=*|--hdu=*) hdu="${1#*=}"; check_v "$1" "$hdu"; shift;;
- -h*) hdu=$(echo "$1" | sed -e's/-h//'); check_v "$1" "$hdu"; shift;;
+ -h|--hdu) aux="$2"; check_v "$1" "$aux"; hdu="$hdu $aux"; shift;shift;;
+ -h=*|--hdu=*) aux="${1#*=}"; check_v "$1" "$aux"; hdu="$hdu $aux"; shift;;
+ -h*) aux="$(echo "$1" | sed -e's/-h//')"; check_v "$1" "$aux"; hdu="$hdu $aux"; shift;;
# Output options
-g|--ds9geometry) ds9geometry="$2"; check_v "$1" "$ds9geometry"; shift;shift;;
@@ -381,8 +382,13 @@ else
if [ x"$hdu" = x ]; then
inwithhdu="$inputs"
else
+ c=1
inwithhdu=""
- for i in $inputs; do inwithhdu="$inwithhdu $i[$hdu]"; done
+ for i in $inputs; do
+ h=$(echo $hdu | awk -vc=$c '{print $c}')
+ inwithhdu="$inwithhdu $i[$h]"
+ c=$((c+1))
+ done
fi
# Read the number of dimensions.
@@ -464,8 +470,13 @@ else
if [ x"$hdu" = x ]; then
inwithhdu="$inputs"
else
+ c=1
inwithhdu=""
- for i in $inputs; do inwithhdu="$inwithhdu $i#$hdu"; done
+ for i in $inputs; do
+ h=$(echo $hdu | awk -vc=$c '{print $c}')
+ inwithhdu="$inwithhdu $i#$h"
+ c=$((c+1))
+ done
fi
# TOPCAT command.