Aliases

An alias is an alternative name or label that can refer to a command, file, a path or any other string of text. By using aliases, you save a lot of time when doing tasks you do frequently. FireCMD allows you to create up to 500 aliases.

When FireCMD command interpreter finds an alias name in the command string, it replaces the alias name with the alias value within the command string. Remember that FireCMD only replaces the alias name only if it is a whole word within the command. A word with word boundaries being a space, double quote or the forward slash is considered as a whole word.

The built-in command alias allows you to define and manage aliases. The syntax of alias command is as follows:

alias [-d <name> | -ir | -nr | -r | <name> [<value>]]

Creating an Alias

You can define a new alias using the syntax:

alias <name> <value>

The "name" parameter specifies the name of the alias, and the "value" parameter specifies a string of characters.

Alias naming rules

  1. The alias name can contain only alpha-numeric characters, '_'(underscore) or '$'(Dollar symbol).
  2. Alias name is not case-sensitive.
  3. You cannot use aliases to redefine built-in aliases and built-in commands .

Alias value does not need to be enclosed by double quotes even if the value contains white spaces. If you specify a value enclosed in double quotes, the double quotes itself will be included in the alias value. The aliases created using the alias command are permanent in nature i.e they don't get destroyed when the shell session ends.

Alias value containing it's own alias name should be avoided as it can create an infinite recursion loop if the alias recursion is enabled. An example of such a mistake: alias cpy cpy abc.txt. Though FireCMD automatically detects such alias recursion and stops further substitution, prevention is always better than cure. In case, if it is neccessary to have a alias value containing it's own alias name then the NPO (Null Placeholder Operator) i.e. "|||" can be used which only substitutes the alias name for a single time even if alias recursion is enabled. For example: alias cpy |||cpy abc.txt. The NPO operator is explained in details in the Escaping Aliases section.

Listing Aliases

You can check the list of existing aliases using the following syntax:

alias

Simply typing the command name alias without specifying any parameters shows output in a table format as shown below.

Listing aliases - FireCMD

If you just want to check value of a particular alias, you can use following syntax:

alias <name>

The "name" is the alias name.

Deleting an Alias

The switch -d allows you to remove an alias. To delete an already existing alias you can use the following syntax:

alias -d <name>

Here the "name" is the name of the alias you want to delete.

Alias Recursion

Alias recursion allows you to define the alias value containing an alias. By default alias recursion is enabled. You can specify following options as arguments to enable, disable or check alias recursion.

OptionAction
-irTells whether alias recursion is enabled or disabled.
-rEnables alias recursion.
-nrDisables alias recursion.

Escaping Aliases

You can use the Null Placeholder Operator (NPO) i.e "|||" (three pipes) to escape an alias. Just prepend "|||" before the alias name. For example, if xyz is an alias that you want to escape, you can specify |||xyz.

In case you want to escape the NPO itself, you can use the backward slash character '\'. For example, the following command prints "||||||".

echohtml \|||\|||


Documentation Index Page