#!/bin/bash 

# set $RA,$DEC from file (or from pipe)
# setpos {-h} file  (or pipe)

#-----------------------------------------------------------------------
while getopts h OPTVAL 
do
    case $OPTVAL in
        h) HELP=1;;
        *) echo "setpos -h for help"; exit -1;;
    esac
done
shift $((OPTIND-1))

if [ $HELP ]; then
  echo " setops -h file (or pipe)"
  echo ' sets RA=$1 and DEC=$2 provided by file or pipe'
  exit
fi

#-----------------------------------------------------------------------
# input from pipe?
#-----------------------------------------------------------------------
case $# in
    0) if [ -p /dev/stdin ]; then
          set -- "/dev/stdin"                     #set $1=/dev/stdin
          IF=$1
        else
          echo "no file given nor is there a trailing pipe";exit -1
       fi;;
    1) IF=$1;;
    *) echo "can accept only one file"; exit -1;;
esac


#-----------------------------------------------------------------------
#The Heavy Lift
#-----------------------------------------------------------------------

awk '{print "export RA="$1, "export DEC="$2}' $IF 

