This bash frontend adds a memory function to the mc calculator, so that typing "M" substitutes in the last result:
change log:
ver. 3.0 7/18/11 added frontend
ver. 3.2 7/19/11 improved memory function; prints with "mc M"
Clear memory with "mc c"
example:
Code:
/mnt/sda2/Desktop $ mc 23.23*2^2 -s3
2158.532
/mnt/sda2/Desktop $ mc M/12
179.88
/mnt/sda2/Desktop $ mc M
179.88
/mnt/sda2/Desktop $ mc c
/mnt/sda2/Desktop $
script:
Code:
#!/bin/sh
if [ "$1" == "" -o "$1" == "-h" ]; then
echo "Substitute "M" for memory; clear with 'mc c'"
mc
exit
fi
VAR=`echo "$@" | grep "M"`
## Print memory with "M" option.
if [ "$VAR" ]; then
if [ "$VAR" == "M" ]; then
cat /tmp/.mc
exit
fi
if [ ! -f /tmp/.mc -o "$(cat /tmp/.mc)" == "" ]; then
echo "nothing in memory"
exit
fi
MEM="$(cat /tmp/.mc | sed 's/\-/m/')"
ARG=`echo "$@" | sed "s/M/$MEM/"`
mc "$ARG" >/tmp/.mc
else
mc "$@" >/tmp/.mc
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum