🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1071

Re: bourne shell query

#1071
From: Scott Yelich
Date: Wed, 05 Sep 1990 16:44
53 lines
2438 bytes
>In article <SCOTT.90Aug30124930@tab00.larc.nasa.gov> scott@tab00.larc.nasa.gov (Scott Yelich) writes:
>>As a side question, does ANYONE have any bourne shell routines which do
                                           ^^^^^^ ^^^^^ ^^^^^^^^
                                           |||||| ||||| ||||||||

>>math... reasonably effeciently?  (For numbers > 1000?)
>I don't know whose UNIX you have but you may have a utility called
>"dc", for "desk calulator".  If you have it, read the man page.  It
>will handle numbers > 1000 AND numbers with decimal fractions.
>   for example:

I'D RATHER USE PERL!
(Thas'a joke, son... I could'a had'a V8! or at least a V5r4!)

Sometimes people program for the ART of it (Oh no! Did I say that?)

for instance, which do you prefer?  Which do you consider better form?

1) if [ "$1" = "$2" ]; then
     echo "Yeas!"
   else
     echo "No-way!"
   fi

- or -

2) test "$1" = "$2" && echo "Yeas!" || echo "No-way!"

What about?

3) if [ "$1" ]; then
     echo "Yup!"
   fi
 
4) eval ${1:+'echo "Yup!"'}

I prefer 2 and 4....

Now, does anyone have and BOURNE SHELL (ie: /bin/sh) routines to do math?
what about getting information like ``ls -Flagsi filename'' without calling
ls?

Please: no perl, exec, c, pascal, fortran, csh, ksh, etc.  /bin/sh

--
Signature follows. [Skip now]

 -----------------------------------------------------------------------------
 Scott D. Yelich                         scott@[xanth.]cs.odu.edu [128.82.8.1]
 After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?''
 Administrator of:    Game-Design requests to <game-design-request@cs.odu.edu>
 ODU/UNIX/BSD/X/C/ROOT/XANTH/CS/VSVN/
 -----------------------------------------------------------------------------
Technical Details
Message-ID: <SCOTT.90Sep5124415@tab29.larc.nasa.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!uunet!abcfd20.larc.nasa.gov!tab29.larc.nasa.gov!scott
References: <26DC6447.15922@maccs.dcss.mcmaster.ca> <8446@orca.wv.tek.com> <75@iconsys> <925@hls0.hls.oz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!uunet!abcfd20.larc.nasa.gov!tab29.larc.nasa.gov!scott
From: scott@tab29.larc.nasa.gov (Scott Yelich)
Newsgroups: comp.unix.shell
Subject: Re: bourne shell query
Message-ID: <SCOTT.90Sep5124415@tab29.larc.nasa.gov>
Date: 5 Sep 90 16:44:15 GMT
References: <26DC6447.15922@maccs.dcss.mcmaster.ca> <8446@orca.wv.tek.com>
 <75@iconsys> <925@hls0.hls.oz>
Sender: news@abcfd20.larc.nasa.gov (USENET File Owner)
Organization: NASA Langley Research Center, Hampton, Va. 23665
Lines: 53
In-Reply-To: george@hls0.hls.oz's message of 5 Sep 90 06:00:42 GMT