bash calc


i really hate when i have to do some basic operation on konsole terminal it’s boring really i know there are already solutions but i have my own script

so ….i want the calculator now and in the konsole with some precision so i did on bash with this stupid stuff

a="$HOME/bin" ; if [[ ! -d "$a"  ]] ; then mkdir "$a" ; else echo $"folder $a exist"; fi ; echo ' if [[ -z "$4" ]] ; then scale=3; else scale="$4" ;fi 

if [[ -z "$3" || -z  "$2" || -z "$1" ]] ; then 

echo "usage : type  number * / - + number precision_number" 
exit 1
else 
 echo "result for :  $1  $2   $3 "

fi 

 

echo "scale="$scale"; "$1" "$2" "$3" "| bc
' >$HOME/bin/stupidcalc
chmod +x  $HOME/bin/stupidcalc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: