Why I hate the Solaris 10 version of
Every so often I discover some exceptional piece of braindamage in Solaris. Here is one of them, presented in handy illustrated form:
$ cat cdtest #!/bin/sh cd /not/there || echo failed echo got here $ sh cdtest ./cdtest: /not/there: does not exist
(No other output is produced.)
Oh yes, Solaris. Killing my script when a
cd fails is just what
I want you to do, especially when this behavior is undocumented and
cannot be turned off. I especially like it when you do this despite
me making every attempt to handle the error.
It goes without saying that this behavior is in no way POSIX standard and in no way matches either the historical behavior of the Bourne shell or how the Bourne shell behaves on other systems.
I think that all of our Solaris shell scripts are about to change from
#!/bin/sh' to '
#!/usr/bin/bash'. I'm not a huge fan of Bash, but
at least it doesn't contain helpful landmines that blow up production
Comments on this page:Written on 23 August 2010.