Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!bbn!oliveb!pyramid!ctnews!mitisft!kemnitz From: kemnitz@mitisft.Convergent.COM (Gregory Kemnitz) Newsgroups: comp.unix.questions Subject: Re: YAPQ (yet another prompt question) Summary: make is spawning a csh and running your .cshrc Message-ID: <1157@mitisft.Convergent.COM> Date: 11 Aug 89 04:13:21 GMT References: <1356@unhd.unh.UUCP> Reply-To: kemnitz@mitisft.UUCP (Greg Kemnitz) Organization: Unisys Network Computing Group, San Jose Lines: 76 In article <1356@unhd.unh.UUCP> rg@unh.UUCP (Roger Gonzalez) writes: I tried to send you mail, but the mailer croaked... > >I got some mail about my questions, but I guess I wasn't specific enough. >Let me try again... > >Uniplus+ System V, Release 2: > >Since a child 'csh' is spawned whenever I 'su', I thought it would be >nice to have the prompt reflect the 'su-ed' state. Hence, in .cshrc, I >had: > >(assume $host = 'iron' and $user1 = 'rg') > >.. >set user2 = `whoami` ^^^^^^ spelling out "who am i" is more portable >if ($user2 == 'root') then > set suffix = '# ' >else > set suffix = '% ' >endif > >if ($user1 == $user2) then > set prompt = $host':'$user1$suffix >else > set prompt = $host':'$user1' ('$user2')'$suffix >endif Sorry, but I have no answer for this - csh's on older sysV's can be flaky. There are lots of quotes here - maybe check that. But some changes in logic would be a quick fix to do the same thing:if ($user2 == 'root') then set prompt = $host':'$user1' (root) # ' else set prompt = $host':'$user1'% ' endif It's as portable and (slightly) more efficient. > [stuff deleted] >The first instance works, but when I su I get: >error in set (or something similar) >iron:rg_ > >My second question had to do with 'make'. Setting the prompt in .cshrc >seems to make it appear when you are running make and it spawns a shell >to handle cd's and the like. > [more make stuff deleted] > >Roger Gonzalez >Marine Systems Engineering Laboratory >University of New Hampshire If you set your SHELL variable to /bin/sh (and have no prompt setting stuff in your .profile) before running make you won't have this problem - or you can take the prompt stuff and put it in your .login, but obviously you won't be able to do the type of prompt stuff you describe above. If you do use the SHELL trick, remember to set your SHELL variable back after running make - otherwise your su's will run the Bourne shell. ----------------------------------+-------------------------------------- Greg Kemnitz | Software without hardware is an idea. kemnitz@Convergent.COM | Hardware without software is a space heater. soon: | kemnitz@postgres.berkeley.edu | --Unknown author