LOCal

Create/Delete a variable in the local scope

LOCal

Shortest form: loc.

Create, change or delete a variable in the current scope. Each rcload script runs in a scope of its own, so a variable set with local inside a script is gone when the script ends. At the drivshell> prompt there is no local scope: local there sets a global variable, which printenv lists under Global Variables and which stays set, across bcmcmd calls and bcmsh sessions, until you delete it or syncd restarts.

  • local: list the variables of the current scope.

  • local <name>: delete the variable.

  • local <name> <value>: set it.

More than two arguments is an error. Names starting with _ cannot be set. Affects only the shell. See Scripting.

Hardware-validated

drivshell> local port ce0
drivshell> echo $port
ce0

Built-in help

Parameters: <variable> [<value>]
    Set variable <variable> to a specific value <value>, in the local
    scope only. Variable in the local scope are not visible in
    recursive diag shells or in rc load files.
        System variables are those that begin with an "_". They may be
    referenced but not set. Use printenv to show the system variables.

Further reading

SDK-6.5.20 HSDK Getting Started Guide (GS-SDK6520-R), plus SDK-6.5.20/21/22 Release Notes (RN-SDK65xx-R), OpenBCM sdk-6.5.27/rc: rc.soc, config.bcm, td3_sanity.soc, cmd_td3_tr514_lr.soc, tr51/tr517_bcm56870_a0.soc, bcm_diag_info.soc …, BCM_SDK命令.