mkhaw@teknowledge-vaxc.UUCP (08/27/87)
I want to define an alias like: alias show 'if ($?\!:1) then \ if ($#\!:1) then \ echo "\!:1 = $\!:1" \ else \ echo "\!:1 is set" \ endif \ else \ echo "\!:1 is not set" \ endif' But the "\" at the end of each line doesn't embed a newline into the alias as needed for the if-then-else to work right. Is there any way to embed newlines into alias definitions? Mike Khaw -- internet: mkhaw@teknowledge-vaxc.arpa usenet: {hplabs|sun|ucbvax|decwrl|sri-unix}!mkhaw%teknowledge-vaxc.arpa USnail: Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303
tytso@paris.mit.edu (Theodore Y. Ts'o) (08/28/87)
In article <16128@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Not Action) writes: >Is there any way to embed newlines into alias definitions? > Let me expand the question. Is there a way to put a *foreach* in an alias definition. Try doing this: alias test 'foreach i (\!*) \ echo $i \ end' And watch your (mine, at least) csh core dump. I think it has to do with how csh determins whether you're on a interactive session or not. The same alias executed from a shell script seems to work well. P.S. Don't try this on your login shell. =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Theodore Ts'o | mit-eddie!mit-athena!tytso | M.I.T., tytso@athena.mit.edu | P.h.D.,