At the request of Ultranurd, allow me to explain my new shell set up.
I’m sick of
bash. The syntax is absurd, and absurd syntax makes me sad. So I’ve just recently set up iPython as my shell. What follows are the relevant config files and some explanation.
First, we want to make sure that iPython is installed, and if we’re on OS X, that it’s installed for Python 2.6. The reason for this is that earlier versions of Python don’t handle tab completion and command line history well—by using
libedit rather than
readline proper, they have some bugs that make things still strictly speaking functional, but hardly visually appealing. You’ll have to trust me, as I don’t want to find the words to explain the ways it looks bad.
So, for OS X, download Python 2.6, install it, and download the latest stable source for iPython and install it with Python 2.6. Something like this:
curl http://www.python.org/ftp/python/2.6.2/python-2.6.2-macosx2009-04-16.dmg -o python-2.6.2-macosx2009-04-16.dmg open python-2.6.2-macosx2009-04-16.dmg # do the installer dance curl http://ipython.scipy.org/dist/ipython-0.9.1.tar.gz -o ipython-0.9.1.tar.gz tar -xzvf ipython-0.9.1.tar.gz cd ipython-0.9.1.tar.gz sudo ./setup.py install
Now, to make sure it’s working, run
ipython and you should see
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) or something like it as the first line. The key part is the
Now, to make this your shell. The Proper Right and True way would involve
chsh, but because I like to sync my homedir configurations across many systems I operate on, I’ve done it the Immoral Bad and Evil way, by just appending
exec /usr/local/bin/ipython -noconfirm_exit -p sh to my
Let me unpack that line.
exec is a
bash builtin that executes a command, replacing
bash with that command.
/usr/local/bin/ipython is just a fully qualified path to
-noconfirm_exit gets rid of the “are you sure you want to quit?” on ctrl-D, which I find annoying. Again, ymmv. Most importantly, there’s
-p sh. Dark secret, I actually have
-p kit, which loads a custom profile called
kit. But the idea is the same, and that profile is based off of the builtin
sh profile. I won’t go in to making a custom profile here; start with
sh and play around with it.
Save the relevant files, open a new terminal just to make sure nothing’s borked (leaving your old terminal still open!). You should see something like
Last login: Tue Jun 16 18:01:54 on ttys000 IPython 0.9.1 [on Py 2.6.2] kit@morgana[~]>
Now, you can pretty freely mix Python and shell commands. If you need to escape something to be shell-y, and make sure it doesn’t get pythonized, just prepend a
!. Enjoy. Comment with questions; I’ll elaborate.