#!/bin/csh
#
# get latest two-line orbital elements from archive.afit.af.mil (129.92.1.66)
#
# this script was stolen from Manfred Bester's SatTrack software distribution,
# and hacked on some by Terry R. Friedrichsen
#
# getElementSets is invoked with one argument - the directory path to the
# xsat file satellites.info
# 
# change the first occurrence of "username" on the line following the ftp
# command to "anonymous", change the second occurrence of "username" on
# that line to your username, and change "host.domain.name" to be the
# fully-qualified domain name of your host
#
if ($#argv != 1) then
    echo 'usage:  getElementSets path'
    exit
endif
#
ftp -n archive.afit.af.mil << !
user username username@host.domain.name
cd /pub/space
get tle.new
quit
!
#
mv tle.dat tle.bak
mv tle.new tle.dat
mv $argv[1]/satellites.info $argv[1]/satellites.info.bak
cp -p tle.dat $argv[1]/satellites.info
