/usr/share/zsh/functions/Math/zmathfunc is in zsh-common 5.4.2-3ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #autoload
zsh_math_func_min() {
local result=$1
shift
local arg
for arg ; do
(( $arg < result )) && result=$arg
done
(( result )) # return
}
functions -M min 1 -1 zsh_math_func_min # at least one argument
zsh_math_func_max() {
local result=$1
shift
local arg
for arg ; do
(( $arg > result )) && result=$arg
done
(( result )) # return
}
functions -M max 1 -1 zsh_math_func_max # at least one argument
zsh_math_func_sum() {
local sum
local arg
for arg ; do
(( sum += $arg ))
done
(( sum ))
}
functions -M sum 0 -1 zsh_math_func_sum
|