From 52e7a7ec1c47f5cb826e50c54f4dc13733157375 Mon Sep 17 00:00:00 2001 From: axel Date: Wed, 25 Apr 2007 01:33:17 +1000 Subject: [PATCH] Actually add the count function. Thanks to Tassilo Horn for the report. darcs-hash:20070424153317-ac50b-f6ab71ad0ea9d74351169d18f1dc856a442ee3f4.gz --- share/functions/count.fish | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 share/functions/count.fish diff --git a/share/functions/count.fish b/share/functions/count.fish new file mode 100644 index 000000000..1ddb30b54 --- /dev/null +++ b/share/functions/count.fish @@ -0,0 +1,11 @@ + +function count --description "Count the number of elements of an array" + set -l lines '' + set result 1 + for i in $argv + set lines $lines\n + set result 0 + end + echo -n $lines|wc -l + return $result +end