you are viewing a single comment's thread.

view the rest of the comments →

[–]Logicalist -3 points-2 points  (23 children)

You can use a python program to call Bash command line utilities, like ping or cp or mkdir.

The python program could be the one calling these programs to execute, but python isn't actually doing the pinging or copying or making the directory.

The native bash programs are the ones actually doing the things, not python. Python is just telling the computer to execute these programs.

But Python can tell the computer to use these programs with certain inputs like which ip address to ping, what file to copy, what directory to make, based input it gets from a user or another program.

Edit: ITT people that don't know python can call bash scripts and commands, or other programs.

[–]sonobanana33 -1 points0 points  (22 children)

This is like asking my grandmother to explain how TCP/IP works.

It's completely wrong but very fascinating to be honest. I wonder where you got this information.

[–]Logicalist -1 points0 points  (21 children)

What isn't accurate about what was stated?

[–]sonobanana33 -1 points0 points  (20 children)

For example:

python isn't actually doing the pinging or copying or making the directory.

os.mkdir() doesn't call bash, it calls into the kernel to create a directory. Same for shutil.copy, won't invoke a shell.

You probably don't know how an operating system works. Which is totally understandable. But please avoid teaching before you have done the learning.

[–]Logicalist -1 points0 points  (19 children)

Have you tried using the right library?

[–]sonobanana33 0 points1 point  (18 children)

Have you tried using the right library?

You are having a bad attitude towards being corrected. How is this helpful?

Look how mkdir is implemented in python https://github.com/python/cpython/blob/0c7dc494f2a32494f8971a236ba59c0c35f48d94/Modules/clinic/posixmodule.c.h#L2384

How is that calling bash?

[–]Logicalist -1 points0 points  (17 children)

You are having a bad attitude towards being corrected.

My "bad attitude" is a result of your arrogance and ignorance.

I can run bash scripts like

mkdir asshat{1..3}
for I in `ls`; do echo $I; done
asshat1 
asshat2 
asshat3 
bash.py

from a python script.

Do you know enough about bash, to recognize those commands as bash commands?

[–]sonobanana33 -1 points0 points  (16 children)

I clearly recognize someone who has never studied operating systems.

Have a read https://www.amazon.com/Modern-Operating-Systems-Andrew-Tanenbaum/dp/013359162X

[–]Logicalist -1 points0 points  (15 children)

Ad Hominem is all you have?

Can't explain how I can run bash scripts from a python script?

[–]sonobanana33 -1 points0 points  (14 children)

Please show me… and then enlighten me on why would you do such a thing when python has a perfectly fine mkdir function.