bourne shell query

Scott Yelich scott at tab29.larc.nasa.gov
Thu Sep 6 02:44:15 AEST 1990


>In article <SCOTT.90Aug30124930 at tab00.larc.nasa.gov> scott at 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 at cs.odu.edu>
 ODU/UNIX/BSD/X/C/ROOT/XANTH/CS/VSVN/
 -----------------------------------------------------------------------------



More information about the Comp.unix.shell mailing list