brutmus
November 10, 2021, 2:06pm
1
Hi!
I’m using RB5009 and ROS 7.1rc6
Works fine in terminal but won’t work in a script. Can someone help me or is it a bug?
Alt1
:for i from=( [:len $ipaddress] - 1) to=0 do={
:if ( [:pick $ipaddress $i] = "/") do={
:put [:pick $ipaddress 0 $i]
}
}
Alt 2
:put [:pick $ipaddress 0 [:find $ipaddress "/"]]
brutmus
November 12, 2021, 7:22am
2
I had to change it to:
:global ipaddress 10.1.101.1/24;
:set ipaddress [:pick $ipaddress 0 [:find $ipaddress "/"]]
to make it work
msatter
November 12, 2021, 11:09am
3
brutmus
November 12, 2021, 12:35pm
4
No, that didn’t work for me, I tried the wiki example.
This line is being ignored:
:put [:pick $ipaddress 0 [:find $ipaddress "/"]]
The solution was to set the variable again
:set ipaddress [:pick $ipaddress 0 [:find $ipaddress "/"]]
Is like you do not know scripting,
“:put” simply write on terminal some text,
if you must “put” the result inside a variable, is obvious than you must use set.
And also on CORRECT way (the $ before ipaddress after set command):
:global ipaddress 10.1.101.1/24
:set $ipaddress [:pick $ipaddress 0 [:find $ipaddress "/"]]
brutmus
November 12, 2021, 2:58pm
6
Thank you for pointing me in the right direction!
I’m new to this, and old, but still learning!
The forum is here for that,
have a nice day.
soipy
August 24, 2024, 2:50pm
8
Can you help me, what am I doing wrong here?
/tool netwatch set [find comment=“isp4”] src-address=(([/ip dhcp-client get [find interface=“ether1” %ipaddress [:pick $ipaddress 0 [find $ipaddress “/”
I want to get the ip address only from the dhcp client but I can’t do it
thank you very much