Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 21 Apr 2014, 11:01
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Perl on Lucid Puppy
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
jpeps

Joined: 31 May 2008
Posts: 3219

PostPosted: Tue 19 Jul 2011, 13:02    Post subject:  

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
 
 fi

cat /tmp/.mc
mc.pet
Description 
pet

 Download 
Filename  mc.pet 
Filesize  1.5 KB 
Downloaded  228 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0349s ][ Queries: 12 (0.0034s) ][ GZIP on ]