Project

General

Profile

$commands » History » Version 2

Per Amundsen, 02/16/2023 09:20 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 2 Per Amundsen
table(ktable).
10
|*Parameter*|*Description*|
11
| N | If N = 0 number of commands, otherwise the Nth command. |
12
| command | Returns [[$true]] if the command exists, otherwise [[$false]]. |
13 1 Per Amundsen
14
*Properties*
15
16 2 Per Amundsen
table(ktable).
17
|*Property*|*Description*|
18
| .builtin | Only list the built-in commands. |
19
| .aliases | Only list the aliases found in scripts/plugins. |
20 1 Per Amundsen
21
*Example*
22
23
<pre>
24
; Print number of total commands.
25
//echo -ag $commands(0)
26
27
; Print number of built-in commands.
28
//echo -ag $commands(0).builtin
29
30
; Print number of aliases commands found in scripts/plugins.
31
//echo -ag $commands(0).aliases
32
33
; Print the first commands.
34
//echo -ag $commands(1)
35
</pre>