- Closing brackets
- Single character commands
- Single character names
- By default, an alias has the following format:
<name>=<command> - A name consists of a single word, without any whitespace characters
- If the name contains special characters, it will be surrounded by single quotes
- If the command contains special characters or whitespace, it will be surrounded by single quotes
- In order to use a single-quote in an alias, you must exit the current context of quotes, type
\'and then open a new context. For example:alias name="it's a command"will becomename='it'\''s a command'. If the single-quote is at the beginning or end of a name or command, the former single-quote is omitted. For example:alias name="'command"becomesname=''command'`. - Aliases support the ANSI-C quoting syntax, see the docs
- Special characters are:
- empty string
- quotes (
',",```) - whitespace characters (
\s,\t,\n,\r) $=()[]{}
- The names
+,=and-are not allowed
- Mocks can generate duplicates
- Current system treats any unescaped \ as invalid, regardless of its position
- You are able to escape whitespace without quotes
Examples
$ alias "a\$1b"="echo hello"
$ alias "'a\$1b"="echo hello"
$ alias "'a\$1b'"="echo hello"
$ alias | grep "echo hello" outputs:
\''a$1b'='echo hello'
\''a$1b'\'='echo hello'
'a$1b'='echo hello'