[Tutor] See execution of script live from command line

Alan Gauld alan.gauld at yahoo.co.uk
Sun Oct 3 07:55:19 EDT 2021


On 02/10/2021 19:48, Julius Hamilton wrote:

> I am running a script with some user input and I’d like to see the script
> being executed at the same time, in split screen at the command line (for
> example, with tmux or GNU screen).
> 
> What are my options for printing out what the computer is doing as it
> executes the code?

That is usually a function of the debugger.
Some debuggers have a trace option that will print out
the line of code being executed or, more commonly, selected
lines of code each time they are executed. (Printing every
line of a non-trivial program generates huge amounts of
output very quickly!)

But be aware that debuggers will slow your code down
massively - often by 100 times or more. Its not really
a practical option for anything non-trivial. And if
its trivial why would you need it - just insert a few
print statements!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list