📜 ⬆️ ⬇️

MySQL Calculator

Calculator, use this:
 ./mysqlcalc "(1 + 3 * 5) * 12"

The code itself:
 #! / bin / bash
 echo "select $ 1;"  |  mysql -uuser -ppassword |  sed '1d'

Or, if you have a distribution without sed, then:
 #! / bin / bash
 echo "select $ 1;"  |  mysql -uuser -ppassword |  tail -n 1

replace user and password with your username and password respectively.

Waiting for bug reports, patches and suggestions for further development!

')

Source: https://habr.com/ru/post/56210/


All Articles