Solaris is quirky. Sometimes it’s well ahead of the curve – zfs, LDOMs, Solaris11 networking  are all visionary.  Then there are things that are SOO00 backward.

Here’s an example with the calculator – bc.

On Linux (or MacOS), you can pass a comparison to bc and it will tell you whether it is right (returns a one) or wrong (returns a zero).

KyloRen:~userme:$   echo "1<2"| bc
1
KyloRen:~userme:$ echo "2<1"| bc

Solaris10  is not so similarly helpful:

userme@sol10:$ echo "1<2" | bc
  syntax error on line 1, teletype

Instead you have to use an archaic invocation (I guess it’s based off an older bc release).  And if it fails, it returns NOTHING.  And even if you agree to comply with its anachronistic invocation, you cannot get it to sanely return zero in case of failure.

Bugger Solaris with a flowerless rosebush!!

userme@sol10:$  echo "if (1<2) 1" | bc
1
userme@sol10:$  echo "if (1<2) 1" | bc
userme@sol10:$  
userme@sol10:$  echo "if (2<1) 1 else 0" | bc
  syntax error on line 1, teletype

 

Advertisements