Skip to content

Instantly share code, notes, and snippets.

@erdemolkun
Created May 6, 2016 12:00
Show Gist options
  • Save erdemolkun/8444b05482449622d849152ad246a4f0 to your computer and use it in GitHub Desktop.
Save erdemolkun/8444b05482449622d849152ad246a4f0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Colors
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
sleep_time=$1
if [ -z "${sleep_time}" ]; then
sleep_time=60
fi
echo "Prints exchange rates every $sleep_time seconds."
while :
do
printf "\n"
printf "Current TRY/USD rates are : \n"
exchangeResults=`ruby enpara.rb | sed 's/\"//g'`
echo -e "$COL_RED$exchangeResults$COL_RESET"
dt=`date +%H:%M:%S`
echo -e "Time : $COL_GREEN$dt$COL_RESET"
printf "\n"
#sleep "$sleep_time"
for ((i=0;i<$sleep_time;i++)); do
sleep 1
printf "*"
done
printf "\n"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment