Referring to other command aliases

You can use an existing command alias within another command alias. Define a first alias:

   alias print=lp

This creates the alias print for the lp command used to print files to your default printer.

This alias can now be used within another alias. For example:

   alias tree='cd; ls -R | print'

The alias tree will list the complete directory tree below the users home directory on the default printer. Multiple commands within an alias can be separated by a semicolon; just as they are on the command line.


[Home] [Index]