#!/usr/bin/env bash # # (script) # # At the very end of script: exitCode=$? echo ${exitCode} > ${exitCode} echo ${exitCode} > status