On Mon, Feb 09, 2004 at 12:49:28PM +0100, Tomasz Zielonka wrote:
On Sun, Feb 08, 2004 at 09:36:16PM +0100, Volker Wysk wrote:
Error Handling Error handling is one thing which is done much more thoroughly in HsUnix than in shells. Failed programs won't be silently ignored. Dynamic exceptions are used for error handling. Non zero exit codes are thrown as exceptions.
Most sh derivaties have -e set option, which causes the shell to (taken from FreeBSD sh man page):
-e errexit Exit immediately if any untested command fails in non-interactive mode.
It doesn't work. #!/bin/sh -e cat nosuchfile | echo hello This script will exit with status 0 (success). If you think about how traditional unix shells are implemented, you will see that they can't get this right. (Which proves the non-existence of reliable non-trivial shell scripts!) I have my own half-finished shell-in-Haskell that handles this. I would be interested to know whether HsUnix does. Andrew