From: Felix W. [mailto:[email protected]]
[email protected]:~$ expr 20 + 5 - 4
21
Now, I work in the shell all day long, so maybe I’m just used to those
things, but I didn’t find them any harder to learn than some
of the ground rules for Ruby.
for shell gurus, it probably should not matter. But w the current IT
state, of admins beset with multitude of problems amongst a sea of
heteregeneous platforms, architecture, networks, os, applications,
languages, whatever, we need a tool that is general purpose, kind on our
brains, yet powerful to drive a small script up to the the biggest web
framework imagineable.
eg,
[email protected]:~$ expr 1+1
1+1
[email protected]:~$ expr 1+.5
1+.5
[email protected]:~$ expr 1+0.5
1+0.5
ruby on the other hand is kinder,…
[email protected]:~$ ruby -e “p 1+1”
2
[email protected]:~$ ruby -e “p 1+.5”
-e:1: no . floating literal anymore; put 0 before dot
p 1+.5
^
-e:1: syntax error, unexpected ‘.’
p 1+.5
^
i see. so ruby is kind to the programmer, providing much error info as
possible
[email protected]:~$ ruby -e “p 1+0.5”
1.5
[email protected]:~$ ruby -e “p 1+0.5+Math::PI”
4.64159265358979
[email protected]:~$ ruby -e “p r=100; c=Math::PIr; area=cr; p area”
100
31415.9265358979
[email protected]:~$ ruby -e “r=100; c=Math::PIr; area=cr; p area”
31415.9265358979
[email protected]:~$ ruby -e “p 2**999”
535754303593133660474212524530000905280702405852766803721875194185175525
562468061246599189407847929063797336458776573412593572642846157021799228
878734928740196728388741211549271053730253118557093897709107652323749179
097063369938377958277197303853145728559823884327108383021491582631219341
8602834034688
[email protected]:~$ echo hello, world | ruby -e “p
gets.chomp.capitalize”
“Hello, world”
[email protected]:~$ rails -v
ruby is kind to me, …or maybe, i’m just getting old and lazy
kind regards -botp