home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 10.3 C Shell Aliases with Command-Line Arguments Chapter 10
Aliases
Next: 10.5 Sourceable Scripts
 

10.4 Aliases in ksh and bash

Virtually everything we've said about aliases applies to the Korn shell ( ksh ) and bash . One thing that's different is the syntax of the alias command, which is:

$ 

alias 

name

=

definition



That is, you need an equal sign (no spaces) between the name and the definition. A good guideline is to use single quotes ( ' ) around the definition unless you're doing something specialized and you understand how quoting ( 8.14 ) works in aliases.

You also can't put arguments inside an alias as the C shell's \! operator ( 10.3 ) does. To do that, use a shell function ( 10.9 ) .

Korn shell aliasing is "overloaded" with a few other functions - like keeping track of the locations of executables. However, this shouldn't prevent you from defining your own aliases as you need them.

- ML


Previous: 10.3 C Shell Aliases with Command-Line Arguments UNIX Power Tools Next: 10.5 Sourceable Scripts
10.3 C Shell Aliases with Command-Line Arguments Book Index 10.5 Sourceable Scripts

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru