Last active
December 29, 2018 04:51
-
-
Save kovalevcon/b562310d1c55983453a4623289587401 to your computer and use it in GitHub Desktop.
Solution for https://www.learnshell.org/en/Shell_Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# enter your function code here | |
function ENGLISH_CALC { | |
case $2 in | |
"plus") echo "$1 + $3 = $(($1 + $3))";; | |
"minus") echo "$1 - $3 = $(($1 - $3))";; | |
"times") echo "$1 * $3 = $(($1 * $3))";; | |
esac | |
} | |
# testing code | |
ENGLISH_CALC 3 plus 5 | |
ENGLISH_CALC 5 minus 1 | |
ENGLISH_CALC 4 times 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment