hide random home http://www.fmi.uni-passau.de/archive/doc/unix/unixhelp/Unixhelp/shell_alias_csh2.1.html (Einblicke ins Internet, 10/1995)

Examples of passing arguments given to a command alias

Examples of passing arguments given to a command alias

1. To pass a single argument to a command alias:

   alias print 'lpr \\!^ -Pps5'
   print memo.txt

The notation !^ causes the first argument to the command alias print to be inserted in the command at this point. The command that is carried out is:

   lpr memo.txt -Pps5

Notice that the ! character is preceded by a \\ to prevent it being interpreted by the shell as a history command.

2. To pass each argument to a command alias:

   alias print 'lpr \\!* -Pps5'
   print part1.ps glossary.ps figure.ps

The notation !* causes each argument given to the alias print to be inserted in the command at this point. The command that is carried out is:

   lpr part1.ps glossary.ps figure.ps -Pps5

Notice that the ! character is preceeded by a \\ to prevent it being interpreted by the shell as a history command.