From 47c05f6b66ebd071a60a76158d7f51d4b49c25a2 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 1 Mar 2017 10:01:01 +0000 Subject: 40622 with typos fixed: functions -Ms. This adds the capability for mathematical functions based on shell functions to have a string argument. Module functions have had this for a long time. --- Test/C04funcdef.ztst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Test/C04funcdef.ztst') diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst index 0cf2b58b9..6a675e0b4 100644 --- a/Test/C04funcdef.ztst +++ b/Test/C04funcdef.ztst @@ -102,6 +102,24 @@ >4 >5 + strmathfunc() { + if [[ $0 = stralpha ]]; then + set -- ${1//[^[:alpha:]]} + fi + (( $#1 )) + } + functions -Ms strlen 1 1 strmathfunc + functions -Ms stralpha 1 1 strmathfunc + print $(( strlen(this, is, a, raw, string) )) + print $(( strlen() )) + print $(( stralpha(this, is, a, raw, string) )) + print $(( stralpha() )) +0:User-defined math functions, string arguments +>24 +>0 +>16 +>0 + command_not_found_handler() { print "Great News! I've handled the command:" print "$1" -- cgit 1.4.1