1) Use bash PS4 to show the line number currently executing (perhaps append start of line with #).
PS4='# ${LINENO}: ' bash -x script
2) Log to a script transaction file.
unset PS4 before a function, reset after function call to restart at function call instead of restarting within a function.
trap signal error & dump variables to state file (via env or set command)
3) check for 'transaction file' on restart of script, if exists,
a) restore saved state file settings;
b) pick up where to start via sdiff of original script and transaction file (aka first line not starting with #
sdiff -v ^'# script transaction_file | sh -
1) Use bash PS4 to show the line number currently executing (perhaps append start of line with #).
2) Log to a script transaction file. 3) check for 'transaction file' on restart of script, if exists, [0] : https://stackoverflow.com/questions/17804007/how-to-show-lin...