Re: Execute commands from file



"tmp123" schrieb >
We have very big files with python commands
(more or less, 500000 commands each file).

It is possible to execute them command by command,

inp = open(cmd_file)
for line in inp:
exec line

might help. You don't get quite the same feeling as
"like if the commands was typed one after the other
in a interactive session", but perhaps this helps.

Warning: the code above is without any error checks.
You might also run into security problems, the example
above assumes you trust your input.

HTH. YMMV.
Martin




.



Relevant Pages

  • Re: Execute commands from file
    ... (more or less, 500000 commands each file). ... It is possible to execute them command by command, ... exec line ... All these services currently offer free registration! ...
    (comp.lang.python)
  • Re: exec() command not functioning in php
    ... jzz wrote: ... the execcommands do not execute. ... Do you expect to see the output of the exec calls? ...
    (comp.lang.php)
  • [UNIX] Vulnerabilities Found in Scponly
    ... SSHd environment files. ... the user can upload a file with a custom ... This provides the user with a means of running arbitrary commands ... the user could execute arbitrary commands by uploading ...
    (Securiteam)
  • Re: [Full-disclosure] FWD Cisco IOS Remote Command Execution Vulnerability
    ... > Vulnerability Alert Cisco IOS Remote Command Execution ... > 9.4 Last Change Cisco has responded to this issue; ... > prone to an issue that may permit gay people to execute arbitrary ... > commands from a password prompt. ...
    (Full-Disclosure)
  • Dont mind if I grouse on some basic topics?? (very long)
    ... I know as experienced programmers you really don't want to hear people gripe ... and moan about basic, indeed critical topics, but I just have to vent on ... commands within a set sequence. ... doesn't appear to uniformly execute them. ...
    (comp.windows.x)