Warning the ID is a bit flaky due to the strange lookup method of the JPL Horizons database. I strongly recommend that you test the ID before running the program, in particular that the output filed has the correct proper name. If you a message 'object not found', try using the debug option. If you pick up the wrong object, try attaching a semi colon afterward. The semicolon must be protected from the UNIX shell by single quotes (don't you love computers). For example to get the asteroid Edith (517) or Vesta (4) you MUST use:
horizons '517;' horizons '4;'
The program calculates the positions from the JPL Horizons API interface. You can try the JPL Horizons web interface. When successful, the program prints out line(s) in Coordinate String format similar to the following (for Mars ID:499):
horizons 499 ra=08:28:26.72 dec=+20:12:25.1 equinox=2000.0 epoch=2017.56975990 name=Mars_(499) dra=0.0260 ddec=-0.0064 mode=topocentricThe keyword / value pairs dra=-0.0126 ddec=0.00030 are the ra and dec track rates are in arc-seconds per second. The ra is not arc.
Use this script for the moon and other planets.
301 Moon (Luna) 499 Mars 599 Jupiter 699 Saturn 799 Neptune 899 Uranus 999 PlutoIf not successful, the program prints an error message and exits with a non-zero status code.
Other white space delimited fields can be placed on the command line and they will be ignored.
debug - prints a lot of debugging information. You may find it useful to look at.
nosend - just prints out the CGI query.