Curtis,
Unfortunatly EEM would not exapnd variable content to be used as part of the EEM syntax...
The only way I am aware you can accomplish what you tried to do is by generating a dynamic EEM applet...
The problem with this specific solution is that actually creating the child policies would break the cli history 😉
So it doesn't really do what you want... so just a nice concept for other similar things...
Something like this:
conf t
no event manager applet PARENT
event manager applet PARENT
event none
action 1 info type cli history
action 2 puts "num entries: $_info_cli_hist_num_entries"
action 3.1 set entry "1"
action 3.2 cli command "enable"
action 3.3 cli command "conf t"
action 3.4 handle-error type ignore
action 4 while $entry le $_info_cli_hist_num_entries
action 4.01 cli command "event manager applet CHILD"
action 4.02 cli command "event none"
action 4.021 puts " >>> ENTRY=$entry"
action 4.03 cli command "action 1 info type cli history"
action 4.04 cli command "action 2 set result $q \$_info_cli_hist_cmd_$entry $q"
action 4.05 cli command "action 3 context save key result_context variable result"
action 4.06 cli command "do event manager run CHILD"
!action 4.07 cli command "no event manager applet CHILD"
action 4.08 context retrieve key result_context variable result
action 4.09 puts "INFO-CLI-HIST-CMD-$entry = $result"
action 4.10 increment entry 1
action 5 end
end
event manager run PARENT