User:Yeti: Difference between revisions
Content added Content deleted
(added B) |
(World Domination!) |
||
Line 28: | Line 28: | ||
=BASH/Self Modyfying Code= |
|||
<pre> |
|||
$ . Thing-1033909978 |
|||
$ type Thing |
|||
Thing is a function |
|||
Thing () |
|||
{ |
|||
local get='shift;local __=$1;shift;echo ${!__}' set='shift;__=$1;shift;local $__="$*";eval "$FUNCNAME () { local $(local | tr "\n" " "); $(type $FUNCNAME | tail +5)"' version=1033909978; |
|||
eval ${!1} |
|||
} |
|||
$ Thing get version |
|||
1033909978 |
|||
$ date -d@$(Thing get version) # ;-) |
|||
Sun Oct 6 13:12:58 UTC 2002 |
|||
$ ## |
|||
$ ## add a new property 'show' |
|||
$ ## |
|||
$ Thing set show local |
|||
$ ## |
|||
$ ## try it |
|||
$ ## |
|||
$ Thing show |
|||
get='shift;local __=$1;shift;echo ${!__}' |
|||
set='shift;__=$1;shift;local $__="$*";eval "$FUNCNAME () { local $(local | tr "\n" " "); $(type $FUNCNAME | tail +5)"' |
|||
show=local |
|||
version=1033909978 |
|||
</pre> |
|||
=Dc/Questions/DROP= |
=Dc/Questions/DROP= |