I work on a script of about 20 lines which I find myself testing time and again by copy-pasting and executing line by line.
Instead of copying-pasting each line and hitting Enter to execute, I would like to copy-paste the entire script without executing it in one go (as one block or an heredocument), but rather in a query like fashion; for example:
The first line get's executed regularly (unconditionally) and I am being queried if I desire to continue to execute the forthcoming line (after having enough time to consider the output);
If I choose to continue - so be it, if not, the operation breaks;
(the result so far will not be rolled back of course, but I would at least not continue to produce further problematic result);
This pattern should be repeated line after line, until the end of the script.
Is there a utility that can help me work in this fashion?
DEBUGtrap or you can show executed commands without stopping by running/bin/bash -x script.shor using#!/bin/bash -xon the first line of the script.