raspalanpi
Posts: 49
Joined: Tue Sep 29, 2015 1:14 am

Terminal v shell from Python RESOLVED

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?
Last edited by raspalanpi on Wed Oct 14, 2020 11:21 pm, edited 1 time in total.
Blundering in the darkness... But with your kind help there is light around the corner...

tpyo kingg
Posts: 982
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: Terminal v shell from Python

Tue Oct 13, 2020 6:50 am

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.

User avatar
jahboater
Posts: 6699
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Terminal v shell from Python

Tue Oct 13, 2020 8:16 am

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
>>> 
>>> 
Pi4 8GB (Raspberry Pi OS 64-bit), Pi4 4GB, Pi4 2GB, Pi1 Rev 1 256MB, Pi Zero

wildfire
Posts: 714
Joined: Sat Sep 03, 2016 10:39 am
Location: Dundee, Scotland

OT: Re: Terminal v shell from Python

Tue Oct 13, 2020 10:26 am

@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
E8 85 A2 40 C9 40 81 94 40 81 95 40 89 84 89 96 A3
Still NF Shirls

Return to “Beginners”