YAPQ (yet another prompt question)

Dr. Scump aland at infmx.UUCP
Tue Aug 15 13:04:24 AEST 1989


In article <1356 at unhd.unh.UUCP> rg at unh.UUCP (Roger   Gonzalez) writes:
|
|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`
|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
|..
|
|What wanted is thus "iron:rg% " for my normal state, and "iron:rg (root)# "
|when I 'su'.
|
|The first instance works, but when I su I get:
|error in set (or something similar)
|iron:rg_
|
|Roger Gonzalez

Did you try su-ing to uid that definitely has csh as its shell?
I suspect that root on your system uses sh by default. sh(1) would
gag on the "set prompt" command, as it is not valid set syntax
for sh.

--
    Alan S. Denney  @  Informix Software, Inc.    
         {pyramid|uunet}!infmx!aland                 "I want to live!
   --------------------------------------------       as an honest man,
    Disclaimer:  These opinions are mine alone.       to get all I deserve
    If I am caught or killed, the secretary           and to give all I can."
    will disavow any knowledge of my actions.             - S. Vega



More information about the Comp.unix.questions mailing list