[comp.bugs.4bsd] C-shell alias bug or bug in user circuitry?

conor@orphan.UUCP (Conor S. Rafferty) (04/16/88)

Sender:

Reply-To:

Followup-To:


I have an alias, called "a".  When executed as "a 1 2" it performs normally.
When executed as "a 1 1", csh leaves my shell hanging in the subsidiary
prompt and a ^D is necessary to escape, leaving a "missing the/endif" complaint.

Here it is:
orphan conor% alias a
if !:^ != !:$ then; echo !:$ ; endif
orphan conor% a 1 2
2
orphan conor% a 1 1
? 
? 
then: then/endif not found.
orphan conor% 

The alias is supposed to echo the second arg if it is different from
the first one.
-C

matt@oddjob.UChicago.EDU (Stop calling me Fred) (04/18/88)

In article <2@orphan.UUCP> conor@orphan.UUCP (Conor S. Rafferty) writes:

) I have an alias, called "a".  When executed as "a 1 2" it performs
) normally.  When executed as "a 1 1", csh leaves my shell hanging in
) the subsidiary prompt and a ^D is necessary to escape, leaving a
) "missing the/endif" complaint.
) orphan conor% alias a
) if !:^ != !:$ then; echo !:$ ; endif

It's true that the csh does not properly parse its input.  A simpler
alias does what you want:

	alias a if \( \!:^ \!= \!:\$ \) echo \!:\$
________________________________________________________
Matt	     University		matt@oddjob.uchicago.edu
Crawford     of Chicago     {astrovax,ihnp4}!oddjob!matt