4 ms·
I'd write run.sh like this: Put the names of the files from that dot-d style folder into some ".cc" file (if it doesn't exist yet); then loop over the lines in
by Joker_vD 3y ago
I'd write run.sh like this: Put the names of the files from that dot-d style folder into some ".cc" file (if it doesn't exist yet); then loop over the lines in the ".cc" file, executing each line if it doesn't start with '#' and then prepending '#' with sed to the just executed line. After the loop, delete the ".cc" file (maybe with a diagnostic messages if all lines in it were #-prefixed). Maybe throw in some traps for reliable SIGINT-handling as well.
- sargstuff 3y agoUse the source![0] 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 - [0] : https://stackoverflow.com/questions/17804007/how-to-show-line-number-when-executing-bash-script https://stackoverflow.com/questions/17804007/how-to-show-lin...