ecFlow's documentation is now on readthedocs!

On Linux architecture, be aware of the slightly different behaviour of ksh functions according to their definition:

With the following syntax, the function gives hand back to the calling script,

so that we define the trapping to simply "exit 1" in case of early exit, in case of error, or when receiving an external signal ;

then the calling script traps this return code and calls ERROR (ecflow_client --abort)

trap 0
ecflow_client --abort=$$
exit 1
# ...
function call {
 trap '{ echo "Error in function"; exit 1; }' 0 $SIGNAL_LIST
 set -ex
 # ...
 trap 0; return 0 ##### reset trap
# ...
trap 0; ecflow_client --complete ; exit 0

In the next example, exit 1 will directly exit the script, so that we have to call ecflow_client to report the abort to the server.

call() {
trap '{ ecflow_client --abort=$$; exit 1; }' 0 $SIGNAL_LIST
 set -ex

In a similar way, in 'if' or 'while' expression, [[ ...]] or ((...)) shall be preferred to [...] to get the trapping propagated as expected.


  1. thanks to Richard Mladek for the reference:

    link once was


  2. pervious link appears broken... here's an alternative explanation