Hi,
in the hope that this may be useful for somebody, I created this
easy shell calculator. It just creates a C++ program, compiles it,
runs it, and removes it.
http://shell-calc.googlecode.com/
I just needed a powerful calculator (bitwise operators, hexadecimal
input/output, etc.), and found nothing appropriate.
Daniel.
|
|
0
|
|
|
|
Reply
|
danielgutson (12)
|
12/25/2009 7:16:51 AM |
|
On 2009-12-25, Daniel de C?rdoba wrote:
> Hi,
> in the hope that this may be useful for somebody, I created this
> easy shell calculator. It just creates a C++ program, compiles it,
> runs it, and removes it.
>
> http://shell-calc.googlecode.com/
>
> I just needed a powerful calculator (bitwise operators, hexadecimal
> input/output, etc.), and found nothing appropriate.
I use:
calc() {
awk 'BEGIN { OFMT="%f"; print '"$*"'; exit}'
}
--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
===== My code in this post, if any, assumes the POSIX locale =====
===== and is released under the GNU General Public Licence =====
|
|
0
|
|
|
|
Reply
|
Chris
|
12/25/2009 10:01:08 AM
|
|
In article <7pjgr3Fl2cU1@mid.individual.net>,
Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>On 2009-12-25, Daniel de C?rdoba wrote:
>> Hi,
>> in the hope that this may be useful for somebody, I created this
>> easy shell calculator. It just creates a C++ program, compiles it,
>> runs it, and removes it.
>>
>> http://shell-calc.googlecode.com/
>>
>> I just needed a powerful calculator (bitwise operators, hexadecimal
>> input/output, etc.), and found nothing appropriate.
>
> I use:
>
>calc() {
> awk 'BEGIN { OFMT="%f"; print '"$*"'; exit}'
>}
And I use:
alias c "echo '\!*' | sed 's/:/;/g' | bc -l"
Once, though, I did something similar to what the OP proposes.
It was a C program that professed to be an expression evaluator.
The core of it was piping something into "gcc -" to create a shared lib,
then calling a function in that shared lib to get the "answer".
|
|
0
|
|
|
|
Reply
|
gazelle
|
12/25/2009 2:20:40 PM
|
|
On 12/25/2009 05:01 AM, Chris F.A. Johnson wrote:
> On 2009-12-25, Daniel de C?rdoba wrote:
>> Hi,
>> in the hope that this may be useful for somebody, I created this
>> easy shell calculator. It just creates a C++ program, compiles it,
>> runs it, and removes it.
>>
>> http://shell-calc.googlecode.com/
>>
>> I just needed a powerful calculator (bitwise operators, hexadecimal
>> input/output, etc.), and found nothing appropriate.
>
> I use:
>
> calc() {
> awk 'BEGIN { OFMT="%f"; print '"$*"'; exit}'
> }
>
I use:
function ca ()
{
awk "BEGIN{ print $* }"
}
is it any different?
|
|
0
|
|
|
|
Reply
|
Younes
|
12/28/2009 9:06:07 AM
|
|
In article <hh9sdu$9hh$1@speranza.aioe.org>,
Younes Zouhair <poboxy@gmail.com> wrote:
....
>> Mr Perfect uses:
>>
>> calc() {
>> awk 'BEGIN { OFMT="%f"; print '"$*"'; exit}'
>> }
>>
>
>I use:
>
>function ca ()
>{
> awk "BEGIN{ print $* }"
>}
>
>is it any different?
His version just has a bunch of little quibbles that you probably don't
care about. I won't go point-by-point, but note that the 'exit' in his
version is there just-in-case you are using an old, decrepit version of
AWK (the ones where it tries to read from standard input even if the
program consists of only a BEGIN clause).
|
|
0
|
|
|
|
Reply
|
gazelle
|
12/28/2009 3:07:22 PM
|
|
2009-12-24, 23:16(-08), Daniel de C�rdoba:
> in the hope that this may be useful for somebody, I created this
> easy shell calculator. It just creates a C++ program, compiles it,
> runs it, and removes it.
>
> http://shell-calc.googlecode.com/
>
> I just needed a powerful calculator (bitwise operators, hexadecimal
> input/output, etc.), and found nothing appropriate.
[...]
What about zsh's zcalc? It seems to have all of the above plus
benefits from zsh's wonderful line editor.
http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#SEC289
--
St�phane
|
|
0
|
|
|
|
Reply
|
Stephane
|
12/30/2009 7:15:27 AM
|
|
|
5 Replies
977 Views
(page loaded in 0.417 seconds)
Similiar Articles: shell calculator - comp.unix.shellHi, in the hope that this may be useful for somebody, I created this easy shell calculator. It just creates a C++ program, compiles it, runs it, ... Re-Build HP-25 Battery Pack - comp.sys.hp48shell calculator - comp.unix.shell Re-Build HP-25 Battery Pack - comp.sys.hp48 shell calculator - comp.unix.shell Re-Build HP-25 Battery Pack - comp.sys.hp48 shell ... Can Calc do hexadecimal arthmetic? - comp.emacsshell calculator - comp.unix.shell Bitwise operators - comp.lang.fortran Can Calc do hexadecimal arthmetic? - comp.emacs Bitwise operators - comp.lang.fortran Can Calc do ... MailX/NAIL text vs IMAP - comp.unix.shellshell calculator - comp.unix.shell MailX/NAIL text vs IMAP - comp.unix.shell shell calculator - comp.unix.shell MailX/NAIL text vs IMAP - comp.unix.shell shell calculator ... How pass a newline character as an argument to a command? (in bash ...shell calculator - comp.unix.shell (in bash ... regsub (and regular expressions in general) trouble. - comp.lang ... How pass a newline character as an argument to a ... Shell script to monitor interface usage - comp.unix.admin ...#!/usr/bin/bash # interface=hme0 # # clear echo "Bandwidth calculator" echo ... packets * 1500 * 8 / 5 /1024 /1024 )) "Mb/s" > done > A comment on shell coding ... Bar charts in PDF - comp.text.texsure, no problem \usepackage{auto-pst-pf} and then run pdflatex -shell-escape ... The only bar chart example for TiKz is the rainfall one, which is a time-series on ... Bitwise operators - comp.lang.fortranshell calculator - comp.unix.shell >> >> http://shell-calc.googlecode.com/ >> >> I just needed a powerful calculator (bitwise operators, hexadecimal >> input/output, etc ... regsub (and regular expressions in general) trouble. - comp.lang ...shell calculator - comp.unix.shell (in bash ... regsub (and regular expressions in general) trouble. - comp.lang ... How pass a newline character as an argument to a ... Time Difference - Comparison - comp.unix.shellTime Difference - Comparison - comp.unix.shell Comparison of regression ... ... Time Difference between Countries and Cities Time difference calculator. This site ... Assembly shell (graphing calculator) - Wikipedia, the free ...On graphing calculators, an assembly shell is a program that is used to run other programs written in the calculator's native machine code rather than the calculator ... Simple Shell Script Calculator - LinuxQuestions.orgHello, I'm writing a simple calculator script and I'm having issues getting it to run correctly. Here is my code: ( while [ $ != 'x' ] do echo "We 7/20/2012 7:15:10 PM
|