Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh tips for "UNIX Power Tools"



Thomas Köhler <jean-luc@xxxxxxxxxxxxxxxxx> writes:

[...]

>   And this one:
>   chmod 755 **/*(/)
>   chmod 644 **/*(.)
>   Hey, all directories are mode 755, while all plain files are mode 644!
>   Again, no find is necessary, as would be for bash:
>   find . -type d -exec chmod 755 {} \;
>   find . -type f -exec chmod 644 {} \;

What's wrong with

        chmod -R go+rX .

However, wacky globbing is probably the thing that's special to zsh
that I consciously use.  OK, completion, too.

For example, a colleague was using some inferior shell (bash, I think)
and having to do things like:

        find . -type f -print | xargs grep -l ...

(It's painful to watch, sometimes.)  In zsh (for reasonably sized
trees, which I find are pretty common, YMMV): "grep -l ... **/*(.)".  

Yes, you can write little shell-scripts to do find ... | xargs, but **
(or ***) is just so much more convenient.  VMS had the right idea,
there.

Which of the directories is biggest?  "du -sk *(/)"
Which file has changed in the last couple of days? "echo *(m-2)"

And so on.  There are lots of really fancy things that zsh can do, but
I tend not to be able to remember them.  Simple stuff like the above
make it worthwhile to use, however, and the necessary syntax is very
easy to remember.



The stat dynamically loadable module is convenient for those operating
systems which don't have a stat executable.


I find these convenient:
        setopt autocd
        setopt autopushcd

I find this nice, but it's mostly cosmetic (path on the left is OK, too):
        RPROMPT="%~"


The built-in completion is excellent (that is, the scripts that are
supplied with 3.1.6-dev-18).  Peter Stephenson's guide to it shows a
number of nice tricks to changing its behaviour.

> - setopt rmstarsilent
>   (I don't like this
>    "sure you want to delete all the files in /home/jean-luc/foooooooo [yn]?"
>   )

Matter of taste.  I like it.


[...]

> - Why not simply use ^Xh instead of ^X^H? Now, I have a feature of
>   zsh-3.1.6-dev-xx on ^Xh:
>   bindkey "^Xh" _complete_help

Why not use M-h, which is built-in, I think.  I don't remember
configuring it, anyway.


[...]



Messages sorted by: Reverse Date, Date, Thread, Author