Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Mar 06, 2017 at 03:50:06PM +0100, Jörg-Volker Peetz wrote: > Greg Wooledge wrote on 03/06/17 14:38: > > On Sun, Mar 05, 2017 at 05:25:49PM +0100, to...@tuxteam.de wrote: > >> If you need floating point numbers, bc (or dc) are your next stops.

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread Jörg-Volker Peetz
Greg Wooledge wrote on 03/06/17 14:38: > On Sun, Mar 05, 2017 at 05:25:49PM +0100, to...@tuxteam.de wrote: >> If you need floating point numbers, bc (or dc) are your next stops. > > Or awk. For some problems, awk is fantastic. > Yes, it helps to sample the number of "bytes" like so:

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread tomas
bitrary precision calculator with some more care, oh, well. > POSIX shells in general may use smaller integers than that. I wouldn't > expect anything outside the range (-2^31 .. +2^31) to be portable. Yes. Proceed with care. > expr(1) is legacy rubbish and should never be used in

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread Greg Wooledge
On Sun, Mar 05, 2017 at 05:25:49PM +0100, to...@tuxteam.de wrote: > If you need floating point numbers, bc (or dc) are your next stops. Or awk. For some problems, awk is fantastic. On Sun, Mar 05, 2017 at 06:14:00PM +, GiaThnYgeia wrote: > I see your 2 and raise you >

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Mon, Mar 06, 2017 at 05:13:36AM -0600, Richard Owlett wrote: > On 03/05/2017 04:12 PM, Jude DaShiell wrote: > >Another external tool at least as good as bc is wcalc and once that > >package gets installed just run wcalc at the command prompt and

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-06 Thread Richard Owlett
On 03/05/2017 04:12 PM, Jude DaShiell wrote: Another external tool at least as good as bc is wcalc and once that package gets installed just run wcalc at the command prompt and you'll have quite a load of examples show up. For my current project I think dc, rather than expr or bc, is the

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread David Christensen
layouts and/or code samples showing how impressive the author can make the script's output. Suggestions please. https://www.perl.org/ Browsing the site I found some unintended humor - "The behavior of binary arithmetic operators depends on whether they're used on numbers or strings.&q

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Jude DaShiell
@lists.debian.org Subject: Re: Recomended tutoial(s) on doing arithmetic in Bash scripts Resent-Date: Sun, 5 Mar 2017 16:26:04 + (UTC) Resent-From: debian-user@lists.debian.org -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 09:42:16AM -0600, Richard Owlett wrote: I'm

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Jude DaShiell
elps. On Sun, 5 Mar 2017, Richard Owlett wrote: Date: Sun, 5 Mar 2017 10:42:16 From: Richard Owlett <rowl...@cloud85.net> To: debian-user <debian-user@lists.debian.org> Subject: Recomended tutoial(s) on doing arithmetic in Bash scripts Resent-Date: Sun, 5 Mar 2017 15:43:08

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 11:48:47AM -0800, David Christensen wrote: > On 03/05/2017 07:42 AM, Richard Owlett wrote: > >I'm interested in "expr" and "bc". > >The man pages lack reasonable examples. > >The tutorial/HOWTO pages confuse the issue with

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Richard Owlett
On 03/05/2017 02:23 PM, to...@tuxteam.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 12:10:43PM -0600, Richard Owlett wrote: [...] How about the whole app You solved my problem with one line. Glad it helped :) [...] I needed to report the number of

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Richard Owlett
ssive the author can make the script's output. Suggestions please. https://www.perl.org/ Browsing the site I found some unintended humor - "The behavior of binary arithmetic operators depends on whether they're used on numbers or strings." http://learn.perl.org/faq/perlfaq4.h

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 06:14:00PM +, GiaThnYgeia wrote: > It is Sunday and I don't like Mondays > tell me why > > to...@tuxteam.de: > > Hm. Neither expr nor bc are bash, they are "external" binaries. If you >

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 12:10:43PM -0600, Richard Owlett wrote: [...] > How about the whole app > You solved my problem with one line. Glad it helped :) [...] > I needed to report the number of bytes downloaded for each portion > of a project

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread David Christensen
On 03/05/2017 07:42 AM, Richard Owlett wrote: I'm interested in "expr" and "bc". The man pages lack reasonable examples. The tutorial/HOWTO pages confuse the issue with fancy page layouts and/or code samples showing how impressive the author can make the script's output. Suggestions please.

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Richard Owlett
On 03/05/2017 12:10 PM, Richard Owlett wrote: On 03/05/2017 10:25 AM, to...@tuxteam.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 09:42:16AM -0600, Richard Owlett wrote: I'm interested in "expr" and "bc". The man pages lack reasonable examples. The

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread GiaThnYgeia
It is Sunday and I don't like Mondays tell me why to...@tuxteam.de: > Hm. Neither expr nor bc are bash, they are "external" binaries. If you > want to do arithmetic in bash, there's $((...)): > > tomas@rasputin:~$ echo $(( (3+4)/3 )) > 2 I see your 2 a

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Richard Owlett
On 03/05/2017 10:25 AM, to...@tuxteam.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, Mar 05, 2017 at 09:42:16AM -0600, Richard Owlett wrote: I'm interested in "expr" and "bc". The man pages lack reasonable examples. The tutorial/HOWTO pages confuse the issue with fancy page

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread tomas
and/or code samples showing how impressive the author can make the > script's output. Hm. Neither expr nor bc are bash, they are "external" binaries. If you want to do arithmetic in bash, there's $((...)): tomas@rasputin:~$ echo $(( (3+4)/3 )) 2 As you see, this does integer arithme

Re: Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Reco
Hi. On Sun, 5 Mar 2017 09:42:16 -0600 Richard Owlett wrote: > I'm interested in "expr" and "bc". > The man pages lack reasonable examples. > The tutorial/HOWTO pages confuse the issue with fancy page layouts > and/or code samples showing how impressive the author

Recomended tutoial(s) on doing arithmetic in Bash scripts

2017-03-05 Thread Richard Owlett
I'm interested in "expr" and "bc". The man pages lack reasonable examples. The tutorial/HOWTO pages confuse the issue with fancy page layouts and/or code samples showing how impressive the author can make the script's output. Suggestions please. TIA

C's pointer arithmetic (Was Re: Setting effective UID for a shell script)

2002-05-16 Thread Perceval Anichini
execv( argv[1], argv + sizeof( argv[1] ) ); Could you explain this? Why would this line be *more* correct than the precedent? The second version makes the pointer arithmetic explicit and has the correct type for the second argument. The first involves an implicit cast from char* to char

Re: C's pointer arithmetic (Was Re: Setting effective UID for a shell script)

2002-05-16 Thread Tom Cook
. Brackets are only syntactic sugar, which allows us not seeing we are dealing with pointer arithmetic. Is that so? I didn't know that. My understanding of the situation was that argv + 4 was equivalent to ((int)argv) + 4, not argv + (char*)4. But I think that I learnt that A long long time ago

Re: C's pointer arithmetic (Was Re: Setting effective UID for a shell script)

2002-05-16 Thread Matijs van Zuijlen
of the type which is pointed by argv. I remember to you that argv[1] = argv + 1. Brackets are only syntactic sugar, which allows us not seeing we are dealing with pointer arithmetic. Is that so? I didn't know that. My understanding of the situation was that argv + 4 was equivalent to ((int

Re: C's pointer arithmetic (Was Re: Setting effective UID for a shell script)

2002-05-16 Thread Pete Harlan
, which allows us not seeing we are dealing with pointer arithmetic. This could hardly be more offtopic, but argv [1] == *(argv + 1) not (argv + 1). (argv [2]), or argv + 2, would have been what the original coder was trying to express. Cheers, --Pete -- To UNSUBSCRIBE, email

Re: arithmetic

1999-12-14 Thread Mark Brown
On Mon, Dec 13, 1999 at 12:37:24AM -0800, [EMAIL PROTECTED] wrote: Are there options (maybe new options since this was last discussed?) that I'm forgetting or that I don't know about? There's Gnumeric. I haven't tried it recently, but for simple things it's been doing quite well for a while

arithmetic

1999-12-13 Thread mcclosk
I'm reluctant to re-open what I know is an old discussion, but ... I've looked in the list archives, and I've searched on the web. All I want is a simple spreadsheet program---very basic arithmetic functions, the ability to save the worksheet as a PS file for previewing and printing, and a semi

Re: arithmetic

1999-12-13 Thread Alan Eugene Davis
Have you tried teapot? It's rudimentary; outputs ok latex, not sure about ps. I'm not sure where to get it. I had problems compiling it on debian systems over the last year and a half, but my older binaries are still ok. If you cannot find the source, I may be able to get a URL for you.