A tiny command line tool to translate numerical values to proper letter values for the Google Chart API. See the official Google API for complete reference.
#!/bin/bash clear echo "----------------------------" echo " tiny Google Chart API tool " echo "http://code.google.com/apis/chart/#chart_data" echo "----------------------------" function datum_encoder() { if [[ "${1}" == "exit" ]] then exit; fi datum=`echo ${1} | \ sed -e 's/^0$/A/g' \ -e 's/^1$/B/g' \ -e 's/^2$/C/g' \ -e 's/^3$/D/g' \ -e 's/^4$/E/g' \ -e 's/^5$/F/g' \ -e 's/^6$/G/g' \ -e 's/^7$/H/g' \ -e 's/^8$/I/g' \ -e 's/^9$/J/g' \ -e 's/^10$/K/g' \ -e 's/^11$/L/g' \ -e 's/^12$/M/g' \ -e 's/^13$/N/g' \ -e 's/^14$/O/g' \ -e 's/^15$/P/g' \ -e 's/^16$/Q/g' \ -e 's/^17$/R/g' \ -e 's/^18$/S/g' \ -e 's/^19$/T/g' \ -e 's/^20$/U/g' \ -e 's/^21$/V/g' \ -e 's/^22$/W/g' \ -e 's/^23$/X/g' \ -e 's/^24$/Y/g' \ -e 's/^25$/Z/g' \ -e 's/^26$/a/g' \ -e 's/^27$/b/g' \ -e 's/^28$/c/g' \ -e 's/^29$/d/g' \ -e 's/^30$/e/g' \ -e 's/^31$/f/g' \ -e 's/^32$/g/g' \ -e 's/^33$/h/g' \ -e 's/^34$/i/g' \ -e 's/^35$/j/g' \ -e 's/^36$/k/g' \ -e 's/^37$/l/g' \ -e 's/^38$/m/g' \ -e 's/^39$/n/g' \ -e 's/^40$/o/g' \ -e 's/^41$/p/g' \ -e 's/^42$/q/g' \ -e 's/^43$/r/g' \ -e 's/^44$/s/g' \ -e 's/^45$/t/g' \ -e 's/^46$/u/g' \ -e 's/^47$/v/g' \ -e 's/^48$/w/g' \ -e 's/^49$/x/g' \ -e 's/^50$/y/g' \ -e 's/^51$/z/g' \ -e 's/^52$/0/g' \ -e 's/^53$/1/g' \ -e 's/^54$/2/g' \ -e 's/^55$/3/g' \ -e 's/^56$/4/g' \ -e 's/^57$/5/g' \ -e 's/^58$/6/g' \ -e 's/^59$/7/g' \ -e 's/^60$/8/g' \ -e 's/^61$/9/g' ;` export ${datum} } while true do echo "type \"exit\" to exit"; echo "type \"_\" for missing data"; read -p "enter number between 0 and 61: " datum_encoder ${REPLY} clear echo "----------------------------" echo " ${REPLY} = ${datum}" echo "----------------------------" done
No comments:
Post a Comment