Created
June 11, 2013 18:30
-
-
Save amashigeseiji/5759447 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testfunc(){ | |
local num=0 | |
local property pre_func_def pre_count new_func_def | |
pre_func_def=$(which testfunc) | |
pre_count=$(echo $pre_func_def|awk 'NR==2 {print $2}') | |
property=$(echo $pre_func_def|awk 'NR==2 {print $2}'|awk -F'=' '{print $1}') | |
new_count=${property}'='$(expr $num + 1) | |
new_func_def=$(echo $pre_func_def|sed -e "s/local $pre_count/local $new_count/") | |
eval $new_func_def | |
echo $num | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment