LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Reply
 
Search this Thread
Old 01-27-2014, 07:08 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Rep: Reputation: 46
Linux elemental cli calculator bc.


Hi: had it not a prompt. I type 'bc', immediately type operands and operators and get the result. No prompt?
 
Old 01-27-2014, 07:23 AM   #2
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 1,118
Blog Entries: 7

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Funny I never knew that existed. Pretty cool. Weird that it complains if you put in an equals. And you have to use -l if you do anything floating point.

Yeah, a prompt would be nice as well as allowing CTRL-C to just quit it. Looks like they put in a signal handler and they give you a statement. But who wants to "type" quit? Many also might look to type exit because that's what you use on an xterm.
 
Old 01-27-2014, 07:24 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Not entirely sure what you did, but bc doesn't have a visible prompt:
Code:
 $ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
 <-- no visible prompt here, just waiting for input
A complete session would look like this:
Code:
$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
3 + 4
7
quit
$  normal bash prompt
 
Old 01-27-2014, 08:04 AM   #4
rtmistler
Senior Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 1,118
Blog Entries: 7

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Took me a bit to locate it; I use google versus go right to GNU, where I eventually find it anyways. bc-1.06.tar.gz Modify the source to have a prompt, maybe make it give actual help versus return zero when you type help, IMHO allow equals, and by default, be able to perform floating point calculations. I'm not going to bother, it's cool but I usually have a desktop up, have plenty of actual calculators around too.
 
Old 01-27-2014, 08:23 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
@rtmistler: some things can be done by invoking bc with the -l option.

Without -l:
Code:
$ bc -q
7/9
0
With -l:
Code:
$ bc -ql
7/9
.77777777777777777777
You can also put your default setting in a file and load it when using bc:
Code:
$ cat bcrc
scale=100
$ bc -q bcrc
7/9
.7777777777777777777777777777777777777777777777777777777777777777777\
777777777777777777777777777777777

Last edited by druuna; 01-27-2014 at 08:25 AM.
 
Old 01-27-2014, 10:55 PM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,125

Original Poster
Rep: Reputation: 46
Thank you guys. Then I was wrong. Yes, the blocking of ^C seems excess of tidiness.

Last edited by stf92; 01-27-2014 at 11:03 PM.
 
Old 01-27-2014, 11:15 PM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046Reputation: 4046
Quote:
Originally Posted by rtmistler View Post
Yeah, a prompt would be nice as well as allowing CTRL-C to just quit it. Looks like they put in a signal handler and they give you a statement. But who wants to "type" quit? Many also might look to type exit because that's what you use on an xterm.
Just use Ctrl+d instead, works on the termianl also.
 
  


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
LXer: Free Medical Records Management software that really works? It's eleMental! LXer Syndicated Linux News 0 08-03-2006 08:21 PM
LXer: Elemental Security Platform Earns Certification from the Center ... LXer Syndicated Linux News 0 04-11-2006 05:03 AM
Linux... on a graphing calculator drbroccoli Linux - Hardware 1 09-02-2005 03:22 PM
Linux on A TI calculator? flamesrock Linux - Hardware 16 12-14-2003 11:04 PM
very elemental questions on networking balam Linux - Networking 1 12-02-2002 08:01 PM


All times are GMT -5. The time now is 01:11 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration