Path: 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 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 [[ 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 ]]