[11] | 1 | |
---|
| 2 | alias - provide an alias for a command |
---|
| 3 | _________________________________________________________________ |
---|
| 4 | |
---|
| 5 | alias [-h] [<name> [<string>]] |
---|
| 6 | |
---|
| 7 | The "alias" command, if given no arguments, will print the definition |
---|
| 8 | of all current aliases. |
---|
| 9 | |
---|
| 10 | Given a single argument, it will print the definition of that alias |
---|
| 11 | (if any). Given two arguments, the keyword "name" becomes an alias for |
---|
| 12 | the command string "string", replacing any other alias with the same |
---|
| 13 | name. |
---|
| 14 | |
---|
| 15 | Command options: |
---|
| 16 | |
---|
| 17 | -h |
---|
| 18 | Print the command usage. |
---|
| 19 | |
---|
| 20 | <name> |
---|
| 21 | Alias |
---|
| 22 | |
---|
| 23 | <string> |
---|
| 24 | Command string |
---|
| 25 | |
---|
| 26 | It is possible to create aliases that take arguments by using the |
---|
| 27 | history substitution mechanism. To protect the history substitution |
---|
| 28 | character `%' from immediate expansion, it must be preceded by a `\' |
---|
| 29 | when entering the alias. |
---|
| 30 | |
---|
| 31 | For example: |
---|
| 32 | |
---|
| 33 | vis> alias read read_\%:1 \%:2.\%:1 |
---|
| 34 | vis> read blif lion |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | will create an alias `read', execute "read_blif lion.blif". |
---|
| 38 | |
---|
| 39 | And... |
---|
| 40 | |
---|
| 41 | vis> alias echo2 "echo Hi ; echo \%* !" |
---|
| 42 | vis> echo2 happy birthday |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | will print: |
---|
| 46 | |
---|
| 47 | Hi |
---|
| 48 | happy birthday ! |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | CAVEAT: Currently there is no check to see if there is a circular |
---|
| 52 | dependency in the alias definition. e.g. |
---|
| 53 | |
---|
| 54 | vis> alias foo "print_network_stats; print_network; foo" |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | creates an alias which refers to itself. Executing the command "foo" |
---|
| 58 | will result an infinite loop during which the commands |
---|
| 59 | "print_network_stats" and "print_network" will be executed. |
---|
| 60 | _________________________________________________________________ |
---|
| 61 | |
---|
| 62 | Last updated on 20050519 10h16 |
---|