To use a simpler version, called
kal that only does a single calculation without formatting the numbers, you can use the following in your
.profile:
Code:
# $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $
#
# sh/ksh initialization
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:.
export PATH HOME TERM
export PAGER=/usr/bin/less
export PS1="[\u@\h]\w: "
kal(){ echo "scale=4 ; $@" | bc ;}
One caveat: the multiplication operator '*' is also used one of the the shell file name wildcard/patterns. To prevent problems you have to either escape the '*' with a blackslash or use single quotes to delimit your arithmetic expression.
To stimulate the neurons in your gr[ae]y matter, an uncommented illustration of something you can run into:
Code:
$ ls -l 2013*
-rw-r--r-- 1 j65nko j65nko 0 Feb 2 19:35 2013-02-01_data24
-rw-r--r-- 1 j65nko j65nko 0 Feb 2 19:40 20134343
$ kal 2013*3
20134343
$ kal 2013\*3
6039
$ kal 2013*4
bc: stdin:1: syntax error: _data24 unexpected
$ kal '2013*4'
8052