Posted on: 27 October 2008 in zsh, shell, tips
Since reading this question on stackoverflow I've been intrigued by zsh, and looking at cool things it can do to make my life easier. I decided to jump on the top-n things bandwagon and publish a quick list of zsh bits I find really useful.
Here's a quick list of my top five tips:
for loops:
for file (prefix) $file:s/prefix/new_prefix/or if you want more than one command in the body, try:
for file (prefix) {one; two; three}{0..10}
will give you a range of values, which you can use in a loop (for n ({0..10})), and
<0-10>lets you match ranges of digits in filename globs.
$variable:s/thing/other_thing/gBut alas, there's no support for regular expressions in these.
**/*.pngwill find all
png files beneath your current directory. You can use this in a loop too:
for f (**/*.txt) {echo $f}Use zsh-lovers to find out more. There's far too much to zsh for me to be able to list it all here. My first stop is usually this man page, and it's usually all I need.
Bonus! Google for zshrc config files. Try github and dotfiles first.