Skip to content

Instantly share code, notes, and snippets.

@noahlz
Created July 13, 2012 20:10
Show Gist options
  • Save noahlz/3107114 to your computer and use it in GitHub Desktop.
Save noahlz/3107114 to your computer and use it in GitHub Desktop.
Attempt to code eval loop in sh
#!/bin/sh
# Futile attempts keep BUG below to not potentially exit the script.
set +e +E
trap '' ERR
# displays the prompt in light cyan.
# TODO: http://stackoverflow.com/q/6788777/7507
echo -e "\e[00;36mEnter expressions, [Ctrl-C] to exit\e[00m"
while :
do
echo -en "\e[00;36m=> \e[00m"
read expression
# BUG: If the expression is invalid, exits the script
echo $((${expression}))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment