murex Shell Docs

Command Reference: alias

Create an alias for a command

Description

alias defines an alias for global usage

Usage

alias: alias=command parameter parameter

!alias: command

Examples

Because aliases are parsed into an array of parameters, you cannot put the entire alias within quotes. For example:

# bad :(
» alias hw="out Hello, World!"
» hw
exec: "out\\ Hello,\\ World!": executable file not found in $PATH

# good :)
» alias hw=out "Hello, World!"
» hw
Hello, World!

Notice how only the command out "Hello, World!" is quoted in alias the same way you would have done if you'd run that command "naked" in the command line? This is how alias expects it's parameters and where alias on murex differs from alias in POSIX shells.

In some ways this makes alias a little less flexible than it might otherwise be. However the design of this is to keep alias focused on it's core objective. For any more advanced requirements you can use a function instead.

Detail

Allowed characters

Alias names can only include alpha-numeric characters, hyphen and underscore. The following regex is used to validate the alias's parameters: ^([-_a-zA-Z0-9]+)=(.*?)$

Undefining an alias

Like all other definable states in murex, you can delete an alias with the bang prefix:

» alias hw=out "Hello, World!"
» hw
Hello, World!

» !alias hw
» hw
exec: "hw": executable file not found in $PATH

Order of preference

There is an order of preference for which commands are looked up: 1. Aliases - defined via alias. All aliases are global 2. murex functions - defined via function. All functions are global 3. private functions - defined via private. Private's cannot be global and are scoped only to the module or source that defined them. For example, You cannot call a private function from the interactive command line 4. variables (dollar prefixed) - declared via set or let 5. auto-globbing prefix: @g 6. murex builtins 7. external executable files

Synonyms

See Also

This site is rebuilt weekly, the content is automatically generated from murex's source code. Last built on Mon May 25 06:11:51 UTC 2020 against commit aa3f3b7aa3f3b7e471543754fdcaf910d4920cad9112b91. Downloadable murex binaries are also built weekly. Current version is 0.48.0120 BETA which has been verified against 29375 tests.