#!/bin/ksh echo 'Interface to Google Chart Line/Area/Bar/Column Chart interfacer created by RJM Programming ...' echo '' equl="=" prefd=",%20[~" suffd="]" uthing="Line" lthing="line" echo "Verb for command line eg. open eg. curl " read verb if [ -z "$verb" ]; then verb="open" fi if [ ! -z "$verb" ]; then echo '' echo "Enter Chart type [Line] out of Line or Bar or Area or Column " read chart_type if [ -z "$chart_type" ]; then chart_type="Line" else uthing="${chart_type}" lthing="`echo ${chart_type} | tr 'A' 'a' | tr 'B' 'b' | tr 'C' 'c' | tr 'L' 'l'`" fi echo '' echo "Enter ${chart_type} Chart title [Company Performance] " read chart_title if [ -z "$chart_title" ]; then chart_title="Company Performance" fi echo '' echo "Enter ${chart_title} Concept title [Year] " chart_title="`echo ${chart_title} | sed '/ /s//_/g'`" read concept_title if [ -z "$concept_title" ]; then concept_title="Year" fi if [ ! -z "$concept_title" ]; then concepttitle="`echo ${concept_title}`" echo '' echo "Enter ${concept_title} Measure(s) title [Sales,Expenses] " concept_title="`echo ${concept_title} | sed '/ /s//_/g' | sed '/,/s//%2C/g'`" read measure_title if [ -z "$measure_title" ]; then measure_title="Sales,Expenses" fi measuretitle="`echo ${measure_title}`" measure_title="`echo ${measure_title} | sed '/ /s//_/g'`" echo '' echo "Enter semicolon separated list of ${chart_type} Chart comma separated ${concepttitle},${measuretitle} data sets eg. 2010,300,200;2011,298,203;2012,321,243;2013,317,221 " read commastring if [ ! -z "$commastring" ]; then cstring="`echo ${prefd}${commastring}${suffd} | sed '/;/s//]%20,%20[~/g' | sed -E '/([~][^,]+)/s//\1~/g'`" commastring="`echo ${cstring}`" echo '' echo 'Starting the call ...' rhs="`echo https://www.rjmprogramming.com.au/PHP/${uthing}Chart/${lthing}_chart.php?${chart_title}__${concept_title}__${measure_title}__listis${equl}${commastring} | sed '/ /s//%20/g'`" echo "$verb ${rhs}" ksh -c "$verb ${rhs}" exit fi fi fi exit