LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-20-2016, 03:00 PM   #1
saslg
LQ Newbie
 
Registered: Jan 2016
Posts: 2

Rep: Reputation: Disabled
Issues using Gnu bc for scripts.


I've done stuff like this for a long time;

$ cat sum.bc
#!/usr/bin/bc
total=0
while (i = read()) {
total += i
}
print total, "\n"

$ cat numbers
33
78
21

$ cat numbers | sum.bc
132

But on some system this just hangs. It seem to be an issue more and more so I assumed somewhere along the way bc changed but I haven't tracked it down to a specific version.

Does anyone know what changed or when (version wise)?

--saslg
 
Old 01-21-2016, 08:46 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,060
Blog Entries: 13

Rep: Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156Reputation: 4156
All I've got is that if I add a "set -xv" to that before the read loop, it outputs 0. It hangs for me too.
Code:
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
 
  


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
Aix - Linux Scripts Migration Issues kumarancs Linux - Newbie 4 09-07-2011 12:50 PM
GNU issues: undefined reference to '_rand' moskymoe Linux - Newbie 2 05-13-2010 05:49 AM
GNU MP issues doowttam Linux - Software 1 07-03-2006 04:13 PM
Are gnu liker scripts available for C files? Min Chen Linux - General 0 05-07-2006 04:19 AM
GNU emacs issues GATTACA Linux - Software 7 08-03-2003 11:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:46 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
Open Source Consulting | Domain Registration