Engine:CCMD alias: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{dev/uiccmd}} | {{dev/uiccmd}} | ||
Creates a new alias in the current context, replacing existing alias if any. | Creates a new alias wiht a callable script in the current context, replacing existing alias if any. | ||
<kua>alias bob "echo fred"</kua> | <kua>alias bob "echo fred"</kua> | ||
| Line 8: | Line 8: | ||
== Details == | == Details == | ||
Used to give alternate name to commands or create custom commands in the current context. | Alias acts like a custom command and runs the text as a script, which can contain a single-word command, statement, or script. Used to give alternate name to commands or create custom commands in the current context. | ||
Aliases do not take any parameters and will run the command, statement, or script verbatim. If a for example an alias of named 'bob' is set to 'echo', it will always run exactly 'echo' which will print nothing, even if you run 'bob "some text". The second paramter will be ignored. | Aliases do not take any parameters and will run the command, statement, or script verbatim. If a for example an alias of named 'bob' is set to 'echo', it will always run exactly 'echo' which will print nothing, even if you run 'bob "some text". The second paramter will be ignored. | ||
Revision as of 21:00, 14 October 2023
Creates a new alias wiht a callable script in the current context, replacing existing alias if any.
alias bob "echo fred"
Arguments
- name - name for the new alias
- value - script string or command to set as alias
Details
Alias acts like a custom command and runs the text as a script, which can contain a single-word command, statement, or script. Used to give alternate name to commands or create custom commands in the current context.
Aliases do not take any parameters and will run the command, statement, or script verbatim. If a for example an alias of named 'bob' is set to 'echo', it will always run exactly 'echo' which will print nothing, even if you run 'bob "some text". The second paramter will be ignored.
Examples
Default values
- 'bob' called without a value. No command, variable or alias named 'bob' exist.
> bob Unknown: bob
- Creates an alias 'bob' and sets to 'echo fred'.
> alias bob "echo fred"
- Same as the first example, but now alias 'bob' exists. The 'echo' command in the 'bob' alias script runs, and prints 'fred'.
> bob fred