ONTAP 9 Manuals ( CA08871-402 )

About positional parameters

You can take advantage of the positional parameter functionality of the ONTAP CLI to increase efficiency in command input. You can query a command to identify parameters that are positional for the command.

What a positional parameter is

  • A positional parameter is a parameter that does not require you to specify the parameter name before specifying the parameter value.

  • A positional parameter can be interspersed with nonpositional parameters in the command input, as long as it observes its relative sequence with other positional parameters in the same command, as indicated in the command_name ? output.

  • A positional parameter can be a required or optional parameter for a command.

  • A parameter can be positional for one command but nonpositional for another.

Using the positional parameter functionality in scripts is not recommended, especially when the positional parameters are optional for the command or have optional parameters listed before them.

Identify a positional parameter

You can identify a positional parameter in the command_name ? command output. A positional parameter has square brackets surrounding its parameter name, in one of the following formats:

  • [-parameter_name] parameter_value shows a required parameter that is positional.

  • [[-parameter_name] parameter_value] shows an optional parameter that is positional.

For example, when displayed as the following in the command_name ? output, the parameter is positional for the command it appears in:

  • [-lif] <lif-name>

  • [[-lif] <lif-name>]

However, when displayed as the following, the parameter is nonpositional for the command it appears in:

  • -lif <lif-name>

  • [-lif <lif-name>]

Examples of using positional parameters

In the following example, the volume create ? output shows that three parameters are positional for the command: -volume, -aggregate, and -size.

cluster1::> volume create ?
   -vserver <vserver name>                Vserver Name
   [-volume] <volume name>                Volume Name
   [-aggregate] <aggregate name>          Aggregate Name
  [[-size] {<integer>[KB|MB|GB|TB|PB]}]   Volume Size
  [ -state {online|restricted|offline|force-online|force-offline|mixed} ]
                                          Volume State (default: online)
  [ -type {RW|DP|DC} ]                    Volume Type (default: RW)
  [ -policy <text> ]                      Export Policy
  [ -user <user name> ]                   User ID
  ...
  [ -space-guarantee|-s {none|volume} ]   Space Guarantee Style (default: volume)
  [ -percent-snapshot-space <percent> ]   Space Reserved for Snapshot Copies
  ...

In the following example, the volume create command is specified without taking advantage of the positional parameter functionality:

cluster1::> volume create -vserver svm1 -volume vol1 -aggregate aggr1 -size 1g -percent-snapshot-space 0

The following examples use the positional parameter functionality to increase the efficiency of the command input. The positional parameters are interspersed with nonpositional parameters in the volume create command, and the positional parameter values are specified without the parameter names. The positional parameters are specified in the same sequence indicated by the volume create ? output. That is, the value for -volume is specified before that of -aggregate, which is in turn specified before that of -size.

cluster1::> volume create vol2 aggr1 1g -vserver svm1 -percent-snapshot-space 0

cluster1::> volume create -vserver svm1 vol3 -snapshot-policy default aggr1 -nvfail off 1g -space-guarantee none

Top of Page