#!/usr/bin/python3
###################################################################################
# Read and print all cmd line arguments 
# argv[0] is always the script name
# All arguments are considered strings
###################################################################################
import sys                           #sys module to accept arguments

print("Content-Type: text/html \n")  #http header with newline char (required)
print("<br><br>")

num_of_args = len(sys.argv)          #length of the argv array

if num_of_args <= 1:                 #name of this script is always provided as argv[0]
    print("Please provide command line arguments")
    quit()

print("You supplied "          + str(num_of_args) + " arguments <br>")
print("Your arguments are... " + str(sys.argv)    + "<br>")

print("Notice the 1st argument is always the name of this script <br><br>")

for arg in sys.argv:
    print(arg + "<br>")
    try:
        arg = float(arg)	    #if a number, convert to numeric 
    except:
        pass                        #do nothing                      
        



#=== link to see the python code =================================================
import os, sys
sys.path.insert(0,'/home/staff/sultan/public_html/cgi-bin/python')
import zCode                          #import func to display the Python code
filename = os.path.abspath(__file__)  #get absolute file name 
zCode.display(filename)               #call it
#=================================================================================