using python at the bash shell?

John McMonagle jmcmonagle at velseis.com.au
Mon Aug 7 21:20:34 EDT 2006


On Mon, 2006-08-07 at 21:03 -0400, John Salerno wrote:
> Hi all. I just installed Ubuntu and I'm learning how to use the bash 
> shell. Aside from the normal commands you can use, I was wondering if 
> it's possible to use Python from the terminal instead of the normal bash 
> commands (e.g. print instead of echo). 

>From a terminal window typing, 

python -c "print 'testing'"

would produce the same results as

echo 'testing'

in bash shell, but obviously not as nice.

> My main reason for asking is that 
> I like using Python for everything, and if I don't need to learn the 
> bash 'language', then I won't just yet.
> 

Just type python and do your stuff in the python interpreter.  This
becomes your shell.

This then got me thinking, how about making python your login shell.  So
I modified my shell login entry in /etc/passwd to /usr/bin/python,
logged in and voila, I was presented with my friendly python shell upon
opening a terminal window.

So the answer is "Yes".





-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Python-list mailing list