PRINTENV

Display current variable list

PRINTENV

Show shell variables as two-column tables (name and value). Read-only.

  • no argument: the variables of the current scope and the global ones;

  • local: only the current scope;

  • global: only the global variables;

  • all: every scope, each titled Scope Level <n>, and the globals.

The keywords must be spelt out. System variables (names starting with _) are included. The shell reads a keyword without consuming it, so after the table it prints PRINTENV: WARNING: excess arguments ignored beginning with '<keyword>'. The warning is harmless.

At the drivshell> prompt there is no local scope (see local), so all four forms print the same single Global Variables table. It holds the shell’s own variables (unit, devname, the chip names, PBMP_ALL …), ?, and every variable set during earlier sessions, since they persist until syncd restarts.

Hardware-validated

drivshell> printenv

    Global Variables | Value
---------------------+---------------------
                kcom = bcm-knet
                path = . /
                unix = 1
               units = 1
              pcidev = 0xb870
              pcirev = 0x01
            trident3 = 1
         BCM56870_A0 = 1
               unit0 = 1
             devname = BCM56870_A0
           fw_prefix = BCM56870
         bcm56870_a0 = 1
            ldevname = bcm56870_a0
             num_ucs = 2
                unit = 0
                   ? = 0
              strata = 1
            PBMP_ALL = 0x0bffffff
                 dma = true
                port = ce0
                   p = 3
      config_var_val = 32768
  config_var_not_set = 0
                   i = 0x30
                   n = 3
            mem_name = ALTERNATE_EMIRROR_BITMAP
   AGM_MONITOR_TABLE = 1
           mem_count = 3114
ALTERNATE_EMIRROR_BITMAP = 1
-------------------------------------------
printenv all

Show every scope, innermost first, then the global variables. Useful inside a script to see $1, $2, ….

Hardware-validated

drivshell> printenv all

    Global Variables | Value
---------------------+---------------------
                kcom = bcm-knet
                path = . /
                unix = 1
               units = 1
              pcidev = 0xb870
              pcirev = 0x01
            trident3 = 1
         BCM56870_A0 = 1
               unit0 = 1
             devname = BCM56870_A0
           fw_prefix = BCM56870
         bcm56870_a0 = 1
            ldevname = bcm56870_a0
             num_ucs = 2
                unit = 0
                   ? = 0
              strata = 1
            PBMP_ALL = 0x0bffffff
                 dma = true
                port = ce0
                   p = 3
      config_var_val = 32768
  config_var_not_set = 0
                   i = 0x30
                   n = 3
            mem_name = ALTERNATE_EMIRROR_BITMAP
   AGM_MONITOR_TABLE = 1
           mem_count = 3114
ALTERNATE_EMIRROR_BITMAP = 1
-------------------------------------------
PRINTENV: WARNING: excess arguments ignored beginning with 'all'
printenv global

Show only the global variables, the same list as setenv with no argument.

Hardware-validated

drivshell> printenv global

    Global Variables | Value
---------------------+---------------------
                kcom = bcm-knet
                path = . /
                unix = 1
               units = 1
              pcidev = 0xb870
              pcirev = 0x01
            trident3 = 1
         BCM56870_A0 = 1
               unit0 = 1
             devname = BCM56870_A0
           fw_prefix = BCM56870
         bcm56870_a0 = 1
            ldevname = bcm56870_a0
             num_ucs = 2
                unit = 0
                   ? = 0
              strata = 1
            PBMP_ALL = 0x0bffffff
                 dma = true
                port = ce0
                   p = 3
      config_var_val = 32768
  config_var_not_set = 0
                   i = 0x30
                   n = 3
            mem_name = ALTERNATE_EMIRROR_BITMAP
   AGM_MONITOR_TABLE = 1
           mem_count = 3114
ALTERNATE_EMIRROR_BITMAP = 1
-------------------------------------------
PRINTENV: WARNING: excess arguments ignored beginning with 'global'

Built-in help

Parameters: [local|global|all]
    Display variables and values. If no options are supplied, all local
    variables in the current scope and global variables are displayed.
    Options have the following meanings:
        local    - display only local variables in the current scope.
        global    - display all global (exported) variables
        all    - display all variables in all scopes
    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), BCM_SDK命令.