Thursday 19 May 2005 — This 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 **/foobarList 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.cList 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: