Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Improved formatting.
Source Link
martineau
  • 124.1k
  • 29
  • 181
  • 319

Execute Commands Sequentially in Python?

I would like to execute multiple commands in a row:

iei.e. (just to illustrate my need):

cmdcmd (the shell)

then

cd dircd dir

and

lsls

and read the result of the lsls.

Any idea with subprocess module subprocess module?

UPDATE:Update:

cd dircd dir and lsls are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, iI would like one subprocess shell and the ability to launch many commands on it.

Execute Commands Sequentially in Python

I would like to execute multiple commands in a row:

ie (just to illustrate my need):

cmd (the shell)

then

cd dir

and

ls

and read the result of the ls.

Any idea with subprocess module ?

UPDATE:

cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, i would like one subprocess shell and the ability to launch many commands on it.

Execute Commands Sequentially in Python?

I would like to execute multiple commands in a row:

i.e. (just to illustrate my need):

cmd (the shell)

then

cd dir

and

ls

and read the result of the ls.

Any idea with subprocess module?

Update:

cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, I would like one subprocess shell and the ability to launch many commands on it.

rewrite title. Talking about multiple commands, not processes.
Link

How to launch multiple subprocesses sequentially Execute Commands Sequentially in python ?Python

edited tags
Source Link
tzot
  • 96.6k
  • 30
  • 151
  • 210

I would like to execute multiple commands in a row:

ie (just to illustrate my need):

cmd (the shell)

then

cd dir

and

ls

and read the result of the ls.

Any idea with subprocess module ?

UPDATE:

cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, i would like one subprocess shell and the ability to launch many commands on it.

I would like to execute multiple commands in a row:

ie (just to illustrate my need):

cmd (the shell)

then

cd dir

and

ls

and read the result of the ls.

Any idea with subprocess module ?

I would like to execute multiple commands in a row:

ie (just to illustrate my need):

cmd (the shell)

then

cd dir

and

ls

and read the result of the ls.

Any idea with subprocess module ?

UPDATE:

cd dir and ls are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, i would like one subprocess shell and the ability to launch many commands on it.

edited title
Link
S.Lott
  • 392.9k
  • 83
  • 521
  • 791
Loading
added 29 characters in body
Source Link
MechanTOurS
  • 1.5k
  • 2
  • 15
  • 18
Loading
Source Link
MechanTOurS
  • 1.5k
  • 2
  • 15
  • 18
Loading