telegram-bot-bash/calc
Kay Marquardt (Gnadelwartz) bf97646361 dev3-rc1 candidate
2019-04-15 14:17:18 +02:00

35 lines
983 B
Bash
Executable File

#!/bin/bash
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#### $$VERSION$$ v0.6-rc1-7-g14eb352
# adjust your language setting here
# https://github.com/topkecleon/telegram-bot-bash#setting-up-your-environment
export 'LC_ALL=C.UTF-8'
export 'LANG=C.UTF-8'
export 'LANGUAGE=C.UTF-8'
unset IFS
# set -f # if you are paranoid use set -f to disable globbing
echo 'Starting Calculator ...'
echo 'Enter first number.'
read -r A
echo 'Enter second number.'
read -r B
echo 'Select Operation: mykeyboardstartshere "Addition" "Subtraction" "Multiplication" "Division" "Cancel"'
echo 'Your anwser can be: add, sub, mul, div or cancel'
read -r opt
echo -n 'Result: '
case $opt in
'add'* | 'Add'* ) expr $A + $B ;;
'sub'* | 'Sub'* ) expr $A - $B ;;
'mul'* | 'Mul'* ) expr $A \* $B ;;
'div'* | 'Div'* ) expr $A / $B ;;
'can'* | 'Can'* ) echo "abort!" ;;
* ) echo "unknown operator!";;
esac
echo "Bye .."