Chapter 29. Custom Commands
Creating Custom Commands
In most shells, aliases are an easy way to shorten a long command line or do a short series of commands. Section 29.2 through Section 29.10 cover C shell aliases. Section 29.4 through Section 29.14 cover aliases in bash, pdksh, and zsh.
All except the oldest Bourne-type shells have shell functions (Section 29.11), which are explained in Section 29.11 through Section 29.13. These are a cross between aliases and shell scripts. They’re good both for shortening command lines and for running a short or long series of commands.
—JP and SJC
Introduction to Shell Aliases
All shells except the original Bourne shell have an “alias” facility that lets you define abbreviations for commands.
The simplest C shell aliases, which are similar to the alias facility in newer Bourne-type shells, are simply a short name for a command and, often, command options or arguments too. The C shell’s aliases can get very complicated. Section 29.3 describes how a C shell alias can use arguments from its command line as it’s invoked.
As we’ve said, aliases in Bourne-type shells (bash , zsh, and ksh) are simpler. Section 29.4 covers some of the differences between those shells and the C shells. Still, the ideas for custom C shell commands are useful in any kind of shell, and if you can’t write something in a simple Bourne-type alias, you almost certainly can do it in a shell function ( Section 29.11).
You can define aliases from the command line, for use in just ...