From 4b4e690ea9db371ddb42ab3dd1705f1de40e57ed Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 8 Jun 2016 08:17:38 -0500 Subject: [PATCH] Add Globbing For All Directories In Zsh as a unix til --- README.md | 3 ++- unix/globbing-for-all-directories-in-zsh.md | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 unix/globbing-for-all-directories-in-zsh.md diff --git a/README.md b/README.md index a4b7b5d..ed8d73f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_429 TILs and counting..._ +_430 TILs and counting..._ --- @@ -379,6 +379,7 @@ _429 TILs and counting..._ - [Find Newer Files](unix/find-newer-files.md) - [Get The Unix Timestamp](unix/get-the-unix-timestamp.md) - [Global Substitution On The Previous Command](unix/global-substitution-on-the-previous-command.md) +- [Globbing For All Directories In Zsh](unix/globbing-for-all-directories-in-zsh.md) - [Globbing For Filenames In Zsh](unix/globbing-for-filenames-in-zsh.md) - [Grep For Files Without A Match](unix/grep-for-files-without-a-match.md) - [Grep For Multiple Patterns](unix/grep-for-multiple-patterns.md) diff --git a/unix/globbing-for-all-directories-in-zsh.md b/unix/globbing-for-all-directories-in-zsh.md new file mode 100644 index 0000000..5f08661 --- /dev/null +++ b/unix/globbing-for-all-directories-in-zsh.md @@ -0,0 +1,20 @@ +# Globbing For All Directories In Zsh + +Globbing in Zsh is an expressive way to generate filenames for commands. +This includes working with directories. If I'd like to run a command against +all directories in the current directory, I can employ the `*(/)` globbing +pattern. + +```bash +$ echo *(/) +one three two +``` + +What about all directories in the root directory? + +```bash +$ echo /*(/) +/Applications /Library /Network /System /Users /Volumes /bin /cores /dev /home /net /opt /private /sbin /usr +``` + +[source](http://zsh.sourceforge.net/Intro/intro_2.html)