I haven't found a solution to this after some searching. I think the search terms are just too general. I'd like to know how to execute a number of lines (at the bash prompt) which are generated by some other source. For example, I have a Python script which dynamically generates a number of bash commands and prints them to stdout. I'd like those lines to be executed as a bash script without having to save them to disk. For example:
$ python example.py touch 1 2 3 4 5 rm 1 2 3 4 5 echo "Done" I'd like to do something like:
$ python example.py | executeLines Does such a command/feature exist in bash? Sometimes one of the commands may exit with a non-zero exit status, so appending && to each command and then running:
$ `python example.py` will not always work and seems to be a clumsy solution.