Can python quickly display results like bash?

robert song robertsong.linux at gmail.com
Wed Mar 18 04:51:33 EDT 2009


thank you, it works with -m trace.

As to sh -x, it is used to expand the variables of command, and display it
before executing.

$ info bash
    * The `-x' (`xtrace') option displays commands other than simple
     commands when performing an execution trace (*note The Set
     Builtin::).


2009/3/18 Chris Rebert <clp2 at rebertia.com>:
> On Tue, Mar 17, 2009 at 11:13 AM, D'Arcy J.M. Cain <darcy at druid.net> wrote:
>> On Tue, 17 Mar 2009 11:10:36 -0700
>> Chris Rebert <clp2 at rebertia.com> wrote:
>>> I've read the manpage for bash and can find no such -x option listed.
>>
>> It's an option from sh(1) that bash copies.  Check the man page for sh
>> (1) for a description.
>
> Ah, I should've thought to google for the sh manpage. Locally, man sh
> just gives me the bash manpage again which doesn't list -x :-(
>
> In answer to the OP's question, you can use the `trace` module
> (http://docs.python.org/library/trace.html):
>
> python -m trace -t somefile.py
>
> will display the lines of source as they are executed.
>
> Cheers,
> Chris
>
> --
> I have a blog:
> http://blog.rebertia.com
>



More information about the Python-list mailing list