Replace and Command with a Variable

Hi,

I was wondering if anyone could answer me the following.

Take a command that populates a local variable “link1interfacestatus” with the current status of a pppoe-client interface with a name of “bob”.

:set link1interfacestatus [/interface pppoe-client get [/interface pppoe-client find name=“bob”] running];

is there anyway to pass into this call a variable instead of having to hard code the term “pppoe-client”?

i.e.

:local “pppoe-client”;
:set link1interfacestatus [/interface get [/interface find name=“bob”] running];

Nothing I do seems to be able to do this?

Thanks, Dominic.

Just a tip to show you the way:

:local item "pppoe-client"
:local command [:parse "/interface $item print"]
$command

The rest is left as an exercise for the reader. :smiley:

Regards,
rock

that’s a great help rock, thanks for your reply. Dominic.