🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #10522

Question about aliases and if statements

#10522
From: R+C Schneider
Date: Wed, 25 Jan 1989 06:33
34 lines
1491 bytes
Hi:

Here's something odd which came up today, maybe someone can shed some
light on it -- I can't find anything about it in the manual.

Script started on Wed Jan 18 21:50:26 1989

ee2% alias abc ls

ee2% abc
admin		chris		lib		roland
bin		cs		mail		src

ee2% if ( a == a ) abc
abc: Command not found.

ee2%
script done on Wed Jan 18 21:51:25 1989

So, why don't aliases work after an if?  I found this behavior under SunOS
3.5, SunOS 4.0.1, UTS, and Xenix.  I suspect there must be a good reason
for it, but what is it?

Roland Schneider
University of Manitoba		<sch@eeserv.ee.umanitoba.ca>

[[ Simple.  Alias expansion is only done on the first word of a command
line, regardless of what the line is.  Try these three lines:
	if ( a == a ) then
	abc
	endif
That works.  Using ";" to separate the command lines will also work.  But
in "if ( a == a ) abc", the string "abc" is not at the front of a command
line and it won't get expanded.  --wnl ]]
Technical Details
Message-ID: <8901190358.AA02633@eeserv.ee.umanitoba.ca>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!mailrus!husc6!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ames!mailrus!husc6!rice!sun-spots-request
From: sch@eeserv.ee.umanitoba.ca (R+C Schneider)
Newsgroups: comp.sys.sun
Subject: Question about aliases and if statements
Message-ID: <8901190358.AA02633@eeserv.ee.umanitoba.ca>
Date: 25 Jan 89 06:33:08 GMT
Sender: usenet@rice.edu
Organization: Eastman Kodak Company, Rochester NY
Lines: 34
Approved: Sun-Spots@rice.edu
Original-Date: 18 Jan 89 21:56 -0600
X-Sun-Spots-Digest: Volume 7, Issue 119, message 9 of 13