Using Aliases

gsh provides a built-in command, alias, which allows any command you would type on the command-line to be renamed. You are not limited to renaming a single command name. Rather, you could rename an entire command-line, which could allow you to use the name "backup" to execute the command "backup +source /system +destination /". The alias command is also a very powerful means of customizing your GNO environment to emulate other computing environments.

To emulate the ORCA environment, the following aliases could be entered into your gshrc file, or a script called orca.alias that gshrc would run:

alias copy cp
alias cat "ls -l"
alias catalog "ls -l"
alias move mv
alias rename mv
alias delete rm
alias type cat
alias prefix cd
alias create mkdir

If you alias a string containing multiple words, you must enclose the string in quotes, as done for the catalog alias. gsh interprets the string as one value. If you do not include both the opening and closing quotes, the alias command will notify you of your error.

You can view any alias' that are set by entering the alias command without any arguments. The setting of a particular alias can be viewed by entering one argument consisting of the name of the alias to view.

If you wish to remove an alias, use the command unalias with the aliased name as the argument. To remove the aliases from the orca.alias file given above, you could do the following:

%unalias copy cat catalog move rename delete type prefix create

Unlike the alias command, the unalias command can take multiple arguments. See the Section called Builtin Shell Commands in the Chapter called Builtin Command Reference for further discussion of the alias and unalias commands.