Prev: how to configure mysql for debug installation
Next: ~~~~~~~~~~~~~~ DIESEL MOTORCYCLE ~~~~~~~~~~~~~~
From: Daniel de Córdoba on 25 Dec 2009 02:16 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.
From: Chris F.A. Johnson on 25 Dec 2009 05:01 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 =====
From: Kenny McCormack on 25 Dec 2009 09:20 In article <7pjgr3Fl2cU1(a)mid.individual.net>, Chris F.A. Johnson <cfajohnson(a)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".
From: Younes Zouhair on 28 Dec 2009 04:06 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?
From: Kenny McCormack on 28 Dec 2009 10:07 In article <hh9sdu$9hh$1(a)speranza.aioe.org>, Younes Zouhair <poboxy(a)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).
|
Next
|
Last
Pages: 1 2 Prev: how to configure mysql for debug installation Next: ~~~~~~~~~~~~~~ DIESEL MOTORCYCLE ~~~~~~~~~~~~~~ |