#! /bin/bash

#...

if test $# -eq 0
then
    echo 'Usage:  '$0' FILE1(FITS) [FILE2 [FILE3 ...]]'
    exit 0
fi

rm -f ARGLIST.txt
for i in $*
do
    MINMAX=`sig_stats $i | grep Signal | awk '{print $3, $5}'`
    echo $i $MINMAX
done > ARGLIST.txt

ARG=`awk '{
    printf(" %s -scale limits %s %s", $1, $2, $3);
}' ARGLIST.txt`

ds9 $ARG
