[net.unix] csh aliases

glenm@mako.UUCP (Glen McCluskey) (03/09/85)

Has anyone thought of modifying the C shell to allow aliases on
other than the first word of each command?  For example, assuming
a new alias command called ``nalias'', one might say:

	% nalias t '/etc/termcap'
	% more t

which would invoke ``more'' on ``/etc/termcap''.  There are a number
of other ways this might be done, such as with shell variables, but
this seems like a convenient thing to have.

This could be generalized (probably too much!) to allow one to change
shell syntax, such as the following:

	% nalias pipe '|'
	% sort xyz pipe uniq

equivalent to

	% sort xyz | uniq


					Glen McCluskey
					..tektronix!mako!glenm

dave@lsuc.UUCP (David Sherman) (03/11/85)

In article <630@mako.UUCP> glenm@mako.UUCP (Glen McCluskey) writes:
||Has anyone thought of modifying the C shell to allow aliases on
||other than the first word of each command?  For example, assuming
||a new alias command called ``nalias'', one might say:
||
||	% nalias t '/etc/termcap'
||	% more t
	...
||	% nalias pipe '|'
||	% sort xyz pipe uniq

Oh, come now. Feeping creaturism. This is what shell variables
are for. I don't use csh at all, and use shell variables in the
Bourne shell for both commands and file/directory names.
	t=/etc/termcap
	more $t

	pipe='|'
	sort xyz $pipe uniq

Dave Sherman
-- 
{utzoo pesnta nrcaero utcs hcr}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsri!lsuc!dave

leiby@masscomp.UUCP (Mike Leibensperger) (03/12/85)

In article <630@mako.UUCP> glenm@mako.UUCP (Glen McCluskey) writes:
>Has anyone thought of modifying the C shell to allow aliases on
>other than the first word of each command?  For example, assuming
>a new alias command called ``nalias'', one might say:
>
>	% nalias t '/etc/termcap'
>	% more t

Indeed, someone has.  Try this:

	% set t=/etc/termcap
	% more $t

Aren't you the guy who posted an article a while back saying how nify
COBOL-like syntax was?

--
Mike Leibensperger
Masscomp; 1 Technology Park; Westford, MA 01886
{decvax,harpo,tektronix}!masscomp!leiby

msb@lsuc.UUCP (Mark Brader) (03/13/85)

David Sherman (lsuc!dave) writes:

> 	pipe='|'
> 	sort xyz $pipe uniq

I don't think he tried it out first, somehow.  Should be:

	eval sort xyz $pipe uniq

which even I as a sh fan must admit is icky.  But then, what's wrong with "|"?

Mark Brader, lsuc!msb

gv@hou2e.UUCP (G.VANNUCCI) (03/14/85)

> Has anyone thought of modifying the C shell to allow aliases on
> other than the first word of each command?  For example, assuming...

   The latest version of ksh, only a few weeks old does that.

                 G. Vannucci   AT&T Bell Labs, Holmdel

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (03/15/85)

>    The latest version of ksh, only a few weeks old does that.

This brings up the question:  What about updates to the items in the
AT&T Toolchest?  Are the items periodically updated?  Can one get the
newer versions for less than full price if he purchased the older ones?