Skip to content

Instantly share code, notes, and snippets.

@tfolbrecht
Last active May 3, 2019 03:42
Show Gist options
  • Select an option

  • Save tfolbrecht/38409136e7ec839c996113e848ac47f3 to your computer and use it in GitHub Desktop.

Select an option

Save tfolbrecht/38409136e7ec839c996113e848ac47f3 to your computer and use it in GitHub Desktop.
Omega Karmas first bash script!
#!/bin/bash
##bin/bash specifies what shell you’re using to carry out the script
echo "Welcome To Kruzi's Calculator"
echo "Operations:"
echo "| To Add Press 1 | To Subtract Press 2 | To Multiply Press 3 | To Divide Press 4 |"
##these echo commands are used to display information from the script to the user via the Terminal Line
read oper
##the read command waits for input from the user
if [[($oper -eq 1)]]
then
bash math/Add.sh
fi
##bash “file location here” calls upon bash script to be ran from file location specified
##fi stops the if process from above
##[[($oper -eq 1)]] is looking for your input via the “read oper” command and checking to see if it equals the number 1
##don't get confused /math is just a directory I created to hold the supportive scripts such as Add.sh
if [[($oper -eq 2)]]
then
bash math/Subtract.sh
fi
if [[($oper -eq 3)]]
then
bash math/Multiply.sh
fi
if [[($oper -eq 4)]]
then
bash math/Divide.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment