z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Defining an alias

z/OS UNIX System Services User's Guide
SA23-2279-00

If you will be using an alias frequently, put the alias command in your profile file ($HOME/.profile). When you issue the OMVS command or start a shell with sh –L, the shell reads the aliases from the file and sets them up immediately. That way, you do not have to type them in every time you start using the shell. See Customizing your .profile for more information about customizing your profile file.

To display all the currently defined aliases, you just enter:
alias
and the shell displays them. You will see a number of aliases that you did not set up. These are predefined aliases that the shell always creates.
When the shell replaces an alias, it checks to see if the result is another alias. The shell continues to check for and replace aliases until no aliases remain or the replacement would result in an infinite loop of alias expansion. For example, the shell defines the alias functions as follows:
alias functions="typeset -f"
Now, you might say to yourself, “Why do I need to type functions when I could just set up the alias f?” You could therefore enter:
alias f=functions
Then you enter:
f abc
the shell replaces f with functions, which the shell in turn replaces with:
"typeset -f"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014