Python forum for Python programmers

Python as a default shell, replacement of bash, sh, cmd ?

Feb 18, 2012 6:58 pm
SherjilOzair

Has it been considered to add shell features to python, such that it can be used as a default shell, as a replacement for bash, etc.

I'm sure everyone would agree that doing this would make the terminal very powerful.

What are your views on this?

Feb 18, 2012 7:21 pm
Jabba Laci
Re: Python as a default shell, replacement of bash, sh, cmd ?

Have a look at IPython (http://ipython.org/). It can interact with the
normal shell very well.

Laszlo

On Sat, Feb 18, 2012 at 19:58, SherjilOzair <sherjilozair@gmail.com> wrote:
> Has it been considered to add shell features to python, such that it can be used as a default shell, as a replacement for bash, etc.
>
> I'm sure everyone would agree that doing this would make the terminal very powerful.
>
> What are your views on this?
> --
> http://mail.python.org/mailman/listinfo/python-list


Feb 18, 2012 9:46 pm
88888 Dihedral
Re: Python as a default shell, replacement of bash, sh, cmd ?

? 2012?2?19????UTC+8??3?21?53??Jabba Laci???
> Have a look at IPython (http://ipython.org/). It can interact with the
> normal shell very well.
>
> Laszlo
>
> On Sat, Feb 18, 2012 at 19:58, SherjilOzair <sherjilozair@gmail.com> wrote:
> > Has it been considered to add shell features to python, such that it can be used as a default shell, as a replacement for bash, etc.
> >
> > I'm sure everyone would agree that doing this would make the terminal very powerful.
> >
> > What are your views on this?
> > --
> > http://mail.python.org/mailman/listinfo/python-list

Yeh, python could be used as a better shell in a text
terminal box and with another text editor in
another box to write scripts in developement.

Also this is easy to test scripts found in the web by copy and paste.



Feb 18, 2012 9:46 pm
88888 Dihedral
Re: Python as a default shell, replacement of bash, sh, cmd ?

? 2012?2?19????UTC+8??3?21?53??Jabba Laci???
> Have a look at IPython (http://ipython.org/). It can interact with the
> normal shell very well.
>
> Laszlo
>
> On Sat, Feb 18, 2012 at 19:58, SherjilOzair <sherjilozair@gmail.com> wrote:
> > Has it been considered to add shell features to python, such that it can be used as a default shell, as a replacement for bash, etc.
> >
> > I'm sure everyone would agree that doing this would make the terminal very powerful.
> >
> > What are your views on this?
> > --
> > http://mail.python.org/mailman/listinfo/python-list

Yeh, python could be used as a better shell in a text
terminal box and with another text editor in
another box to write scripts in developement.

Also this is easy to test scripts found in the web by copy and paste.





Previous Thread: Parse a profile
Next Thread: #line in python

Related Forum Topics
Can I fully replace GNU Bash with Python?
This question concerns my process of creating Swift Linux from the
base distro (antiX Linux in the past, Linux Mint Debian Edition now).
(NOTE: The process I'm describing here is an oversimplification.)

All of my development work takes place in the ~/develop directory.
This is the directory...
(don't bash me too hard) Python interpreter in JavaScript
Hello,

I am looking for a way how to bring Python interpreter to JavaScript, in order to provide a web-based application with python scripting capabilities. The app would have basic IDE for writing and debugging the python code, but the interpretation, of course, would be done in JavaScript....
Question about speed of sequential string replacement vs regex or
curious question.

suppose you have 300 different strings and they need all be replaced
to say "aaa".

is it faster to replace each one sequentially (i.e. replace first
string to aaa, then do the 2nd, 3rd,...)
, or is it faster to use a regex with “or” them all and do replace one
shot?...
How to use shell return value like $? In python?
exp:
os.system('ls -al')
#I like to catch return value after this command. 0 or 1,2,3....
does python support to get "$?"?
then I can use something like:
If $?==0:
........
................
TIA
david




Re: Embedding Python in a shell script
On Fri, Jun 17, 2011 at 10:57 AM, Jason Friedman <jason@powerpull.net> wrote:
> The code behaves as I expect and want, but the de-denting of the
> Python call is unattractive, especially unattractive the longer the
> Python call becomes.  I'd prefer something like:
>

#!/bin/bash
for i in...
Embedding Python in a shell script
$ cat test.sh
#!/bin/bash
for i in 1 2 3 4; do
python -c "
for j in range($i):
print j
"
done

$ sh test.sh
0
0
1
0
1
2
0
1
2
3

The code behaves as I expect and want, but the de-denting of the
Python call is unattractive, especially unattractive the longer the
Python...
Question on Python 3 shell restarting
How may I get a fresh Python shell with Idle 3.2 ?
I have to run the same modules several times with all
variables cleared.

Thanks,

franck


About UNIX shell trap, any relative function in Python ?

Hi All

Machine : AIX 5.3
Python : 2.6.2

In UNIX have, trap to run defined CLEAN_UP function. When HUP INT
KILL STOP TERM will run CLEAN_UP function.

trap 'echo "\n\nProcessing Clean up"; CLEAN_UP; exit' HUP INT KILL
STOP TERM

Any relative function in Python ?

moonhkt


Python shell that saves history of typed in commands that willpersist between reboots
Hi,

Using Windows. Is there a python shell that has a history of typed in
commands?

I don't need output of commands just what I typed it. I need it to
save between sessions - something that no shell seems to do. If I
reboot there will still be a command history somewhere.

Like bash...
Unicode by default
hi folks,
I am puzzled by unicode generally, and within the context of python
specifically. For one thing, what do we mean that unicode is used in
python 3.x by default. (I know what default means, I mean, what changed?)

I think part of my problem is that I'm spoiled (American,...