#!/bin/csh -f
ls    $*      >& /dev/null && set Lfic = `ls -1 $* | sort -t. -k 2 -n` 
if ($?Lfic == 0) then 
  ls *.*$1.fits >& /dev/null && set Lfic = `ls -1  *.*$1.fits | sort -t. -k 2 -n` 
endif
if ($?Lfic == 0) then 
  if ($#argv > 0) then
    echo "Probleme dans la determination des images a traiter."
    exit(1)
  endif
  set Lfic = `ls *.fits | sort -t. -k 2 -n`
endif
echo "fichiers: $Lfic"

foreach f($Lfic)
  if ($#Lfic > 1) echo "***** $f *****"
  awk -f param.awk $f 
end
exit(0)
