PYSH? (was:Re: calling ksh script from python)
Fernando Perez
fperez.net at gmail.com
Thu Jun 2 14:24:45 EDT 2005
Paul McNett wrote:
> Cameron Laird wrote:
>> Infidel. While I sure feel that way about csh(1), it
>> surprises me you'd criticize ksh(1) so. 'Fact, 'mong
>> all the *sh-s, I *recommend* ksh for programming. May-
>> be the two of us see things differently.
>
> I keep wondering how difficult it would be to make a Python shell that
> exposes all of Python but also includes some builtin commands such as
> cd, mkdir, etc., that are just names bound to os.chdir, os.mkdir..., and
> is smart enough to take a given command from the user and try to do a
> os.system() on it based on the path. IOW, I'd love to have all of Python
> available as my unix shell, while still doing shell-type stuff such as
> traversing directories, launching applications, etc.
>
> There's likely a project that does this already that I'm just unaware of.
yes, there is:
planck[~]> ipython -p pysh
Welcome to pysh, a set of extensions to IPython for shell usage.
help(pysh) -> help on the installed shell extensions and syntax.
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
Type "copyright", "credits" or "license" for more information.
IPython 0.6.15 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
IPython profile: pysh
fperez at planck[~]|1> cd test
fperez at planck[~/test]|2> ls
argv.py* cf.py div.py exit.py* lcomp.py sanner.py* times.sh*
ast.tcl* data error.py* foo.old pplot2.py* scopes.py* t.py
avg.py* die.py err.py foo.py pplot.py* splot.py vars.py
bar.py div.c err.pyc inspectbug.py pylabug.py strings.py visex.py
bar.pyc div.f exit2.py* inter.py ramptest.py* tgp.py xplot.py*
fperez at planck[~/test]|3> $$a=ls e*py
fperez at planck[~/test]|4> a
<4> ['error.py', 'err.py', 'exit2.py', 'exit.py']
fperez at planck[~/test]|5> for f in a:
|.> if len(f)>6:
|.> wc -l $f
|.>
64 error.py
2 exit2.py
10 exit.py
fperez at planck[~/test]|6> Exit
Cheers,
f
More information about the Python-list
mailing list