Path: utzoo!attcan!uunet!samsung!xylogics!bu.edu!nntp-read!jbw From: jbw@bucsf.bu.edu (Joe Wells) Newsgroups: comp.unix.shell Subject: Re: Multiline aliases in csh ? Message-ID: Date: 25 Oct 90 08:58:50 GMT References: Sender: news@bu.edu.bu.edu Organization: Boston University Computer Science Department Lines: 34 In-reply-to: aps@tut.fi's message of 23 Oct 90 04:36:23 GMT aps@tut.fi (Suntioinen Ari) writes: Is there any way to define multi line alias in csh ? What I mean is (for example) if-else or foreach loop as a part of alias. Sure, here's an appropriately twisted example: alias which '(set argv=($path) target=\!*; whichi)' alias whichi 'if (! $#argv) set status=1 && whichii' alias whichii \ 'if (-x "$1/$target") set status=1 && shift && eval "whichi" \\ || if ($#argv > 0) echo "$1/$target"' Conditionals are done with: if (condition) set status=1 && else-statement || then-statement Looping is done with recursion, which requires you to use "eval", otherwise the csh will detect the recursion and refuse to do it. Note, the last line should actually read: || echo "$1/$target"' but yet another csh bug prevents it from working that way. Enjoy, -- Joe Wells PS. I think this example clearly justifies why the author(s) of the csh will be roasting in hell for a long long long time.