LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2010, 10:51 AM   #1
tubu_cuteguy
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
Thumbs down a new shell for doing mathematical operation


hello frendz,
I am working on a project which is based on doing mathematical operation
on the existing shell
for example for addition in the shell
without writing expr'$a+$b '
i want to do simple calculation
such as
c=a+b;



please help me
 
Old 07-28-2010, 10:52 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Perhaps:

Code:
c=$((a+b))
does what you need?
 
Old 07-28-2010, 02:10 PM   #3
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
You could also use the "bc" utility, try man bc for details.
 
Old 07-28-2010, 02:45 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by tubu_cuteguy View Post
hello frendz,
I am working on a project which is based on doing mathematical operation
on the existing shell
for example for addition in the shell
without writing expr'$a+$b '
i want to do simple calculation
such as
c=a+b;



please help me
We would love to help you!! What is your question?

In addition to the other suggestions here, have you looked at Python?
 
Old 07-28-2010, 06:56 PM   #5
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 729

Rep: Reputation: 75
Hi.
Quote:
psh is a Perl program which executes a read-eval loop with enough
options so that general behavior reasonably similar to more traditional
shells like 'sh' or 'bash' can be achieved, while still allowing arbi-
trary perl expressions to be evaluated.
-- excerpt from man psh, q.v.
For a simple interactive example:
Code:
% psh
psh% $a=2
psh% $b=3
psh% $c=$a*$b
psh% print "$c\n";
6
Best wishes ... cheers, makyo

Last edited by makyo; 07-28-2010 at 08:41 PM.
 
Old 07-28-2010, 07:16 PM   #6
fbobraga
Member
 
Registered: Jul 2010
Location: São Paulo - Brasil
Distribution: Debian 7 / Crunchbang 11
Posts: 229

Rep: Reputation: 41
I think that python shell/interpreter is what you are looking for: http://docs.python.org/release/2.5.2...00000000000000

Last edited by fbobraga; 07-28-2010 at 07:17 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A mathematical problem for programmers dracuss Programming 19 10-14-2009 07:46 PM
mathematical puzzle sycamorex General 18 02-14-2008 10:28 AM
threads for mathematical calculations? skywalker27182 Programming 3 02-13-2005 10:25 AM
Firefox-0.9.1 mathematical fonts goofyheadedpunk Linux - Software 0 08-10-2004 12:02 PM
Need mathematical software! Bogdan Linux - Software 1 05-18-2002 06:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration