0

It is .sh for mac os

It is .bat for windows

But what is it for linux

Thanks

:) Linux

IliasMh
  • 50
  • 6
  • Your question is confusing. The *title* asks for how to execute an external command from Python, but the body of the question seems to ask for what extension Linux uses to name script files. Python doesn't really care about the extension used. – Martijn Pieters Oct 13 '20 at 16:47
  • The question in your title is answered in [How to call an external command?](https://stackoverflow.com/q/89228) (much better than the answers given here). – Martijn Pieters Oct 13 '20 at 16:48

4 Answers4

1

It is .sh just like in macOS. These operating systems are similar if you are familiar with one it will be easy to learn the other one

n0nvme
  • 663
  • 1
  • 12
1

You can also use subprocess to execute the same

import subprocess
subprocess.run(["ls","-l"])

You can find more details https://docs.python.org/3/library/subprocess.html

Pranjal Doshi
  • 374
  • 2
  • 12
0

The syntax for python is:

import os
os.system("command")

For bash .sh like Mac os

Timur U
  • 375
  • 13
0

For bash .sh like Mac os, These operating systems are similar if you are familiar with one it will be easy to learn the other one

IliasMh
  • 50
  • 6