[comp.unix.questions] csh alias command

mikey@ontek.com (michael "krill-man" lee) (04/17/91)

When I list my aliases one of them shows up parenthesized.  It
is one that is of the form

  alias foo foo -options

Typing "alias" results in

  foo     (foo -options)

Other aliases which have different names than the command they
alias to and aliases which have been quoted do not seem to get
parenthesized.  I'm not really confused, I just thought it was
weird and it's been a while since I posted an article margined
on the left and right like this.

      the krill

jik@athena.mit.edu (Jonathan I. Kamens) (04/18/91)

In article <1864@ontek.com>, mikey@ontek.com (michael "krill-man" lee) writes:
|> Typing "alias" results in
|> 
|>   foo     (foo -options)
|> 
|> Other aliases which have different names than the command they
|> alias to and aliases which have been quoted do not seem to get
|> parenthesized.

That's interesting, because they do on my system:

% alias foo foo -bar
% alias | grep foo
foo     (foo -bar)
% alias foo bar -bar
% alias | grep foo
foo     (bar -bar)

The fact that the alias is listed in parentheses means that there are multiple
"words" in the alias.  If you define an alias without quotes, it gets multiple
words in it.

Although I can't say for certain, I doubt very much the parentheses (or
whether or not the alias has multiple words) has any effect on what happens
when it is actually used.  At least I can't come up with a situation that
would behave differently if the same alias were defined with and without
quotes (assuming that all special characters were quoted as necessary in the
version defined without quotes).

By the way, cross-posting between comp.unix.questions and talk.bizarre is
rude.  Especially if you don't put "Followup-To: comp.unix.questions" in your
posting.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

guy@auspex.auspex.com (Guy Harris) (04/18/91)

Is this some sneaky trick to drag some poor newbie into cross-posting to
"talk.bizarre", so you can roast him?

In any case, for those who are curious:

 >When I list my aliases one of them shows up parenthesized.  It
 >is one that is of the form
 >
 >  alias foo foo -options
 >
 >Typing "alias" results in
 >
 >  foo     (foo -options)
 >
 >Other aliases which have different names than the command they
 >alias to and aliases which have been quoted do not seem to get
 >parenthesized.

A quick look at the 4.3BSD C shell code indicates that aliases with only
one token aren't enclosed in parentheses, and those with more than one
token are.

	alias foo "foo -options"

has only one token, namely '"foo -options"'.

	alias foo foo -options

has two, namely 'foo' and '-options'.