You are not logged in.

#1 2011-03-31 19:43:22

davric
Member
Registered: 2011-01-01
Posts: 19

/root/.zshrc prompt not working

my ~/.zshrc is

PS1='%B%F{black}[%b%F{yellow}%n%B@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ ' 

and my /root/.zshrc is

PS1='%B%F{black}[%b%f%K{red}%F{white}%n%B%F{yellow}@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ '

when I am in the terminal and type su it doesn't change the PS1 colors or anything for root, how can I correct this?

Offline

#2 2011-03-31 20:00:43

pimanac
Member
Registered: 2010-10-18
Posts: 3

Re: /root/.zshrc prompt not working

Hi
You will want to use

 su - 

or

 su --login 

to make it a login shell.  From the manpage here http://linux.die.net/man/1/su

you can also find the man page with

 man su 

hope this helps!

Offline

#3 2011-03-31 20:14:48

davric
Member
Registered: 2011-01-01
Posts: 19

Re: /root/.zshrc prompt not working

I have tried those, unfortunately it doesn't change anything

Offline

#4 2011-04-02 02:42:08

davric
Member
Registered: 2011-01-01
Posts: 19

Re: /root/.zshrc prompt not working

bump

Offline

#5 2011-04-02 02:55:43

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: /root/.zshrc prompt not working

What terminal are you using?

Offline

#6 2011-04-02 04:40:50

davric
Member
Registered: 2011-01-01
Posts: 19

Re: /root/.zshrc prompt not working

urxvt, zsh

Offline

#7 2011-04-02 08:36:18

caxap
Member
Registered: 2011-03-05
Posts: 17

Re: /root/.zshrc prompt not working

no, what does the /etc/passwd say about it?

Last edited by caxap (2011-04-02 08:36:38)

Offline

#8 2011-04-04 07:31:23

pimanac
Member
Registered: 2010-10-18
Posts: 3

Re: /root/.zshrc prompt not working

I think i see what caxap is getting at...

root does not use zsh by default.  You will have to pass the -s flag to su and specify you want to use zsh.
su -s /bin/zsh -

example

andrew@myth ~ $ cat .zshrc                                                                                                              
# Created by newuser for 4.3.11                                                                                                         
PS1='%B%F{black}[%b%F{yellow}%n%B@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ '                                                               
andrew@myth ~ $ zsh --login                                                                                                             
Q:      Why do the police always travel in threes?                                                                                      
A:      One to do the reading, one to do the writing, and the other keeps                                                               
        an eye on the two intellectuals.                                                                                                
[andrew@myth:~]$ echo ${PS1}
%B%F{black}[%b%F{yellow}%n%B@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ 
[andrew@myth:~]$ su -s /bin/zsh -
Password: 
At the source of every error which is blamed on the computer you will find
at least two human errors, including the error of blaming it on the computer.
[root@myth:~]$ cat .zshrc 
PS1='%B%F{black}[%b%f%K{red}%F{white}%n%B%F{yellow}@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ '
[root@myth:~]$ echo ${PS1}
%B%F{black}[%b%f%K{red}%F{white}%n%B%F{yellow}@%U%M%u%f%b:%B%F{red}%~%F{black}]%f%b$ 
[root@myth:~]$ 

as an alternative, you can change root's default shell with .

usermod -s /bin/zsh root 

Offline

Board footer

Powered by FluxBB