Question about aliases and if statements
R+C Schneider
sch at eeserv.ee.umanitoba.ca
Wed Jan 25 16:33:08 AEST 1989
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 at 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 ]]
More information about the Comp.sys.sun
mailing list