[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Alias help needed



"Bob Tilley (AT&T)" <bobt@cocoa.tybrin.com> writes:

> I wish to use the expression "catl <filename>" to execute the
> commands "cat <filename> | less".
>
> Is it possible to use 'alias' in the definition?
>
> "alias catl='cat $0 | less'" seems like a good idea, but I don't
> know if the '$0' works in a simple alias.

I think in Bourne-style shells (bash, ash, ksh, zsh), you almost
always want to use shell functions instead of aliases:

  catl() { cat "$@" | less }

(Where "$@" is sh-ish for "all of the rest of the command-line
arguments, quoted correctly".)

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: