$commands » History » Version 1
Per Amundsen, 10/14/2022 12:51 PM
| 1 | 1 | Per Amundsen | _Added in 4.3_ |
|---|---|---|---|
| 2 | |||
| 3 | *$commands(N/command)* |
||
| 4 | |||
| 5 | Returns the Nth built-in and/or alias command. |
||
| 6 | |||
| 7 | *Parameters* |
||
| 8 | |||
| 9 | N - If N = 0 number of commands, otherwise the Nth command. |
||
| 10 | command - Returns [[$true]] if the command exists, otherwise [[$false]]. |
||
| 11 | |||
| 12 | *Properties* |
||
| 13 | |||
| 14 | .builtin - Only list the built-in commands. |
||
| 15 | .aliases - Only list the aliases found in scripts/plugins. |
||
| 16 | |||
| 17 | *Example* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | ; Print number of total commands. |
||
| 21 | //echo -ag $commands(0) |
||
| 22 | |||
| 23 | ; Print number of built-in commands. |
||
| 24 | //echo -ag $commands(0).builtin |
||
| 25 | |||
| 26 | ; Print number of aliases commands found in scripts/plugins. |
||
| 27 | //echo -ag $commands(0).aliases |
||
| 28 | |||
| 29 | ; Print the first commands. |
||
| 30 | //echo -ag $commands(1) |
||
| 31 | </pre> |