in my script,i want to record pppoe account logging time to an array named ontime,i can get the time ,but i don’t know how to assign value to array elment, anyone could help me ?
thanks
There might be a way to script a workaround somehow, but I can’t think of it at the moment. What are some of the $location and $mytime pairs that you would be seeing, or some examples?
I use the following function in my configuration scripts. Because it rewrites the array you might need to be careful in when you invoke it.
# modifies a single entry in an array. Natively ROS doesnt have this function
:global setARRAYENTRY do={
# Parameters:
# $1 the array
# $2 index of entry to be changed
# $3 new value of entry to be changed
:local MYARRAY
:set MYARRAY
:for i from=0 to=([:len $1]-1) do={
:if ($i = $2) do={
:set MYARRAY ($MYARRAY, $3)
} else={
:set MYARRAY ($MYARRAY, [:pick $1 $i])
}
}
:return $MYARRAY
}
This is how I use it:
:global mystore
.....
# set up initial mystore here
......
:local index 42
:local newvalue 1234567
:set mystore [$setARRAYENTRY $mystore $index $newvalue ]