To Z Or Not To Z
Blasphemous Preist writes "For all of you looking for a good religious war over shells, IBM has just posted the following article on zsh.
It's very informative and comes from a strong Linux and Z-shell proponent. If you're in to hack around with something other than bash zsh may be z answer."
I use it as my default shell everywhere I work, on both NT and Unix. Here's some of the features that I love:
Programmable Completion
You can define completion for different commands in different ways. eg.
ping/telnet completes with the list of machines on my network
man completes with my man pages
kill completes with job numbers
java completes with all my available Java classes (I have to provide a Perl utility to help with this (classfind) though)
Recursive and intelligent wildcarding
ls **/* completes through directories, subdirectories and the like. I never really have to use find anymore
ls **/*(ah-5) finds files accessed within the last 5 hours
ls **/*(L0) finds files of zero length
ls **/*(@) finds symbolic links
etc.
Jerry Peek has quizzed the Zsh mailing lists for info so he can write about it in the next Unix Power Tools. Hopefully Zsh's profile will be raised somewhat.
Rather surprisingly, everyone seems to have missed the biggest advantages zsh has over the other shells. Please guys, go out and try the latest development version! The amount of work spent on the 3.1.x development series over the last few years has been monumental. We're now at 4.0.1-pre-2, and its feature set is so far ahead of 3.0.x (let alone bash/tcsh) it's not even funny.
For example, the article raves about programmable completion. Quite right too - I feel like crying every time I watch someone struggle without it (although as my cow-orkers well know, I'm a bit weird like that :-)
BUT! The article didn't mention that beginning in version 3.1.6, the completion system underwent a complete rewrite, and now has sophisticated out-of-the-box completions for over 400 commands. Typing a Perl one-liner and you get stuck after perl - because you can't remember which option letters to use? Hit TAB and you get a list of all of them plus explanations. Want to quickly browse the structures of some of your MySQL tables? Type mysqlshow , hit TAB, and you get a list of your databases to complete from. Choose one, hit TAB again, and you get a list of the tables within that database. Want to scp an awkwardly-named file from a remote machine? Type a few letters of it, hit TAB and zsh will connect to the remote machine, get a file list, and use it to complete the file so you don't have to type it.
If you want to know more, have a look at
http://adamspiers.org/computing/zsh/
Things have moved on a bit since I wrote it, but it should hopefully give you a taster.
The article also mentioned prompts ... Well, if you're into eye candy,
there's also a prompt theming system which I confess to writing :-)
ObScreenshot:
http://adamspiers.org/computing/zsh/files/prompt s/
10) precmd() calls commands before displaying the prompt .zlogout ;-)
9) user binding of keys for command line editing
8)
7) ignores duplicates in the history list
6) best prompt:
spider:src/linux/include/linux *
(cuts longer directory names)
5) compatible with Bourne Shell, works as expected
4) best completion
3) make |& less feeds stdout and and stdin into less, shorter than make 2>&1 | less
2) Z-Shell has the best vi emulation
1) more exclusive than vim
I recommend the stable version 3.0.8, zsh in distributions are often from the 3.1 branch. This version breaks my skeleton files and some things (vi binding) doesn't work as I'm used too.
and you're asking whether "To Z Or Not To Z"?!
The answer is, of course, "Not To Z." It's St. Patrick's Day! Have another guinness. You have all Sunday afternoon to Z.