alias Adds a new alias or modifies an existing one |
||
Usage |
||
alias [-q] (<alias_name>) <implementation> alias [-q] (<alias_name>){} |
||
Description |
||
Adds the alias <alias_name> with the specified <implementation> code.
The implementation code can be either a single KVS instruction
or an instruction block (instruction list enclosed in braces). If the alias already exists, it is replaced with the new implementation. If the <implementation> is empty (e.g. {} or just a ;) the alias <alias_name> is removed. If the remove form is used but the specified <alias_name> does not exist in the alias store then a warning is printed unless the -q (--quiet) switch is used. If <alias_name> contains a <name>:: prefix, then the alias is created in the namespace specified by <name>. If the namespace does not exist, it is created. Any alias without the <name>:: prefix is created in the root namespace. Namespaces are useful to avoid collisions in alias names between scripts. Only really common aliases should be created in the root namespace - all of the internal functionality of your scripts should be hidden in your own namespace. The special syntax <namespace>:: can be used to remove all the aliases belonging to the specified namespace. When creating aliases this syntax is not allowed. |
||
Switches |
||
|
||
Examples |
||
# Add the alias j alias(j) { join $0; } # Remove the alias j alias(j){} # Add the alias j in namespace letters alias(letters::j) { echo "j" } # Kill the whole 'letters' namespace alias(letters::){} | ||
See also |
||
Aliases and functions |