Examples of passing arguments given to a command alias

To pass a single argument to a command alias:

   alias print 'lp \\!^ -dps5'
   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:

   lp memo.txt -dps5

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


To pass each argument to a command alias:

   alias print 'lp \\!* -dps5'
   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:

   lp part1.ps glossary.ps figure.ps -dps5

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


[Home] [Search] [Index] This site maintained by unixhelp@mathcs.duq.edu