Zsh-lovers

Thursday 19 May 2005This is over 19 years old. Be careful.

I occasionally use a Unix shell, but I don’t use much of it. I can’t tell the difference between csh and bash (and probably not even sh). So when I read the tips and tricks for zsh at zsh-lovers, I felt a bit like Kramer (“You just blew my mind!”). This is a Unix shell turned up to 11 (or maybe even 12!):

List file ’foobar’ via recursive search in directories:

$ ls **/foobar

List files with suffix c and pro (e.g. foo.c, bar.pro):

$ ls *.(c|pro)

List all .c-files except ’lex.c’:

$ ls *.c~lex.c

List all zero-length-files which are not group- or world-writable:

$ ls *(L0f.go-w.)

List all .c-files for which there doesn’t exist a .o file:

$ c=(*.c) o=(*.o(N)) eval ’ls ${${c:#(${~${(j:|:)${o:r}}}).c}:?done}’

I don’t think I’m going to be using those last two anytime soon...

Comments

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.