For example I have a function that appends to a file a few lines. But if something else fails in the script I wouldn’t want to fix it and execute it again, and then have those lines duplicated.
FWIW, not having side-effects from being ran twice is called “idempotency”
I’ve thought of creating a json where I indicate what parts have been executed successfully.
Json or some other indicator of status. If statements and flat files you can easily delete to reset state. You have the right notion as to how to do it. Some sort of indicator that something has run. Possibly consider having an over arching concept of a run so you clearly status like run1.json or /run1/state.statefile
Ask specific questions about how to code something in sh, bash, zsh, etc
General bash discussion on lemmy.ml
Create Post From: