Zsh-lovers

Thursday 19 May 2005

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:

name
email
Ignore this:
not displayed and no spam.
Leave this empty:
www
not searched.
 
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.