Re: execute a shell script from a python script



spec wrote:
Thanks, actually there are no args, is there something even simpler?

Thanks
Frank

you could try os.system()

From the docs:

system(command)
Execute the command (a string) in a subshell. This is implemented
by calling the Standard C function system(), and has the same
limitations. Changes to posix.environ, sys.stdin, etc. are not
reflected in the environment of the executed command.

On Unix, the return value is the exit status of the process encoded
in the format specified for wait(). Note that POSIX does not specify
the meaning of the return value of the C system() function, so the
return value of the Python function is system-dependent.

On Windows, the return value is that returned by the system shell
after running command, given by the Windows environment variable
COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always
0; on cmd.exe systems (Windows NT, 2000 and XP) this is the exit status
of the command run; on systems using a non-native shell, consult your
shell documentation.

Availability: Macintosh, Unix, Windows.

.



Relevant Pages

  • Re: Redirection issue
    ... 1- execute input commands from standard input, ... the phrase "it does not work anymore" carries very little meaning. ... after compilation and execution of the shell with a simple command like ... all the command in the file are executed as well. ...
    (comp.lang.c)
  • Re: Redirection issue
    ... 1- execute input commands from standard input, ... the phrase "it does not work anymore" carries very little meaning. ... after compilation and execution of the shell with a simple command like ... all the command in the file are executed as well. ...
    (comp.lang.c)
  • Re: Executing command with Runtime.getRuntime.exec() fails
    ... More portable, since on my windows system at least, there is an ls. ... command at the command line. ... The appropriate command interpreter for each os could be found through ... be sure, and programming is about certainty, is to explicitly execute the ...
    (comp.lang.java.programmer)
  • Re: Running Ring3 command from Ring0 in Windows?
    ... I am looking for a way to execute Ring3 command (for ex, ... The motivation of this is that I can exploit Windows kernel, ... executing in Ring0 only, and want to run some code in Ring3, too. ...
    (Pen-Test)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)