From c924183b3711416bbb62761e7da0b24ecb9a6afe Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Thu, 26 Mar 2020 11:34:51 +1100 Subject: [PATCH] Introduce utility function 'count', inspired by the fish builtin, which simply echoes the number of arguments it receives (e.g., count *.txt) --- config/zsh/all/functions | 1 + config/zsh/functions/count | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 config/zsh/functions/count diff --git a/config/zsh/all/functions b/config/zsh/all/functions index 5a8e892..5c86f8c 100644 --- a/config/zsh/all/functions +++ b/config/zsh/all/functions @@ -2,5 +2,6 @@ # autoloaded functions must be declared in every kind of zsh: they aren't # inherited in the environment so non-login shells need them, and you'll want # to call one in a script so non-interactive shells need them. +autoload count autoload enphp autoload -Uz zargs zmv diff --git a/config/zsh/functions/count b/config/zsh/functions/count new file mode 100644 index 0000000..aafa2f3 --- /dev/null +++ b/config/zsh/functions/count @@ -0,0 +1,2 @@ +#! zsh +echo $#