Have function defs always taken arbitrary commands?

 $ mksh -c 'fun() echo fun; fun; typeset -p KSH_VERSION'
    fun
    typeset -r KSH_VERSION='@(#)MIRBSD KSH R54 2017/03/21'

 $ ssh ormaajdroid "/system/bin/sh -c 'fun() echo fun; fun; typeset -p 
KSH_VERSION'"
    fun
    typeset -r KSH_VERSION='@(#)MIRBSD KSH R52 2016/01/20'

Weee these are fun!

 $ mksh -x <<\EOF
    f () ${x+eval nameref x=10; f () '${x+eval :} f ${x+; echo} $((n--)) 
"$@"';} f "$((n++))" "$@"
    nameref x=4; f
    EOF
    
    + typeset -n 'x=4'
    + f
    + f 0
    + f 1 0
    + f 2 1 0
    + f 3 2 1 0
    + eval nameref 'x=10;' f '()' '${x+eval :} f ${x+; echo} $((n--)) "$@";' f 
4 3 2 1 0
    + typeset -n 'x=10'
    + f 4 3 2 1 0
    + f 5 4 3 2 1 0
    + f 4 5 4 3 2 1 0
    + f 3 4 5 4 3 2 1 0
    + f 2 3 4 5 4 3 2 1 0
    + f 1 2 3 4 5 4 3 2 1 0
    + eval : f ';' echo 0 1 2 3 4 5 4 3 2 1 0
    + : f
    + echo 0 1 2 3 4 5 4 3 2 1 0
    0 1 2 3 4 5 4 3 2 1 0

Doesn't apply to the `function' keyword so I'm guessing that's not a "feature".

Reply via email to