Page 1 of 1

Terminal v shell from Python RESOLVED

Posted: Mon Oct 12, 2020 10:57 pm
by raspalanpi
Shelling out from Python via os.system takes me to a screen much like terminal. What is/are the difference(s) if any?

Re: Terminal v shell from Python

Posted: Tue Oct 13, 2020 6:50 am
by tpyo kingg
They are both language interpreters. However, the one is also a primary interface to the operating system. With modifications the other could be too. I think IPython might be one such example. The default shell in Raspberry Pi OS is Bash, which is based on the Bourne shell. There are a lot of shells to choose from, beyond Bash: zsh, ksh, POSIX shell, fish, oilshell,

If you can tolerate PDFs, page 187 of the October 1983 issue of BYTE (page 189 of either PDF) has an article by the Bourne shell's author, Stephen R. Bourne:

https://vintageapple.org/byte/pdf/19831 ... 0_UNIX.pdf

https://archive.org/details/byte-magazine-1983-10

There is also a fairly good introduction to the Unix shell history even if it starts to diverge in recent years.

http://www.softpanorama.org/People/Shel ... tion.shtml

Don't worry about the layout colors.

Re: Terminal v shell from Python

Posted: Tue Oct 13, 2020 8:16 am
by jahboater
raspalanpi wrote:
Mon Oct 12, 2020 10:57 pm
Shelling out from Python via os.system takes me to a screen much like terminal. What is/are the difference(s) if any?
What did you give as the argument to os.system() ???
For example, if I give bash, I just get a normal bash shell:-

Code: Select all

pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ python3
Python 3.9.0 (default, Oct 12 2020, 03:48:08) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system("bash")
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ echo hello
hello
pi@raspberrypi:~ $ exit
0
>>> 
>>> 

OT: Re: Terminal v shell from Python

Posted: Tue Oct 13, 2020 10:26 am
by wildfire
@tpyo kingg

WOW extreme nostalgic moment, I used to have hundreds of those and similar magazines in my garden shed until a house move meant they had to go. Didn't know that they (Byte) had been archived on the Net.

Thanks for the link. :D