NOTE & DISCLAIMER:
THIS SHOULD NOT BE ATTEMPTED BY ANY BEGINNER USER OR ANY USER WITH CRITICAL DATA. THE FOLDERS I DIVE INTO ARE RESPECTIVELY THE MOST IMPORTANT FILES IN MAC OS X FOR THE UNIX SIDE. IF THESE FILES ARE REMOVED, DELETED, OR OVERWRITTEN YOU MAY NOT BE ABLE TO RECOVER THEM THUS CAUSING YOUR SYSTEM TO FAIL. DO NOT ATTEMPT THIS UNLESS YOU KNOW WHAT YOU ARE DOING. I AM NOT RESPONSIBLE FOR WHAT YOU DO TO YOUR SYSTEM.
Now that we got that out of the way here's what I did:
I always open up terminal to do quick calculations like adding or subtracting or whatever, but there's not way to do it (at least I don't know how to without using python or that). Calculator takes too long to get to, even by Spotlight, and the Widgets are just too much of memory hogs, so here's what I did:
I made a python program - calc.py:
and my calc sh program
Calc - nope its not calc.sh its just calc
I moved calc into /usr/bin
I created a directory in /usr/bin called python_apps
I then moved calc.py into /usr/bin/python_apps
I had to sudo to do those 3 things (or you can su into it).
Now I just type in this to receive these results:
Now I can make other Python utilities/programs and link them to an SH program, I could even do a menu program to access various utilities.
THIS SHOULD NOT BE ATTEMPTED BY ANY BEGINNER USER OR ANY USER WITH CRITICAL DATA. THE FOLDERS I DIVE INTO ARE RESPECTIVELY THE MOST IMPORTANT FILES IN MAC OS X FOR THE UNIX SIDE. IF THESE FILES ARE REMOVED, DELETED, OR OVERWRITTEN YOU MAY NOT BE ABLE TO RECOVER THEM THUS CAUSING YOUR SYSTEM TO FAIL. DO NOT ATTEMPT THIS UNLESS YOU KNOW WHAT YOU ARE DOING. I AM NOT RESPONSIBLE FOR WHAT YOU DO TO YOUR SYSTEM.
Now that we got that out of the way here's what I did:
I always open up terminal to do quick calculations like adding or subtracting or whatever, but there's not way to do it (at least I don't know how to without using python or that). Calculator takes too long to get to, even by Spotlight, and the Widgets are just too much of memory hogs, so here's what I did:
I made a python program - calc.py:
Code:
#!/usr/bin/env python
import sys
num = float(sys.argv[1]) + float(sys.argv[2])
print sys.argv[1]," + ",sys.argv[2]," = ",num
num = float(sys.argv[1]) - float(sys.argv[2])
print sys.argv[1]," - ",sys.argv[2]," = ",num
num = float(sys.argv[1]) * float(sys.argv[2])
print sys.argv[1]," * ",sys.argv[2]," = ",num
num = float(sys.argv[1]) / float(sys.argv[2])
print sys.argv[1]," / ",sys.argv[2]," = ",num
and my calc sh program
Calc - nope its not calc.sh its just calc
Code:
python /usr/bin/python_apps/calc.py $1 $2
I moved calc into /usr/bin
I created a directory in /usr/bin called python_apps
I then moved calc.py into /usr/bin/python_apps
I had to sudo to do those 3 things (or you can su into it).
Now I just type in this to receive these results:
Code:
Shawn-Barnes-iBook-G4:~ sbarn$ calc 10.252 284.24
10.252 + 284.24 = 294.492
10.252 - 284.24 = -273.988
10.252 * 284.24 = 2914.02848
10.252 / 284.24 = 0.0360681114551
Shawn-Barnes-iBook-G4:~ sbarn$
Now I can make other Python utilities/programs and link them to an SH program, I could even do a menu program to access various utilities.