You are not logged in.
Hi!
First I have to say that I have installed Arch few days ago and it's pretty sweet stuff -- but I guess you already have heard that oh-so-many-times!
So there is it, I would like to change my prompt's color everytime <enter> is pressed in the terminal (well, everytime a new prompt is shown).
But so far I was only able to change my prompt's color everytime a new terminal is opened, with this code in .bashrc :
# color changing for the prompt
colors=("\[\e[0;30m\]" "\[\e[0;34m\]" "\[\e[0;32m\]" "\[\e[0;36m\]" "\[\e[0;31m\]" "\[\e[0;35m\]" "\[\e[0;33m\]" "\[\e[0;37m\]" "\[\e[1;30m\]" "\[\e[1;34m\]" "\[\e[1;32m\]" "\[\e[1;36m\]" "\[\e[1;31m\]" "\[\e[1;35m\]" "\[\e[1;32m\]" "\[\e[1;37m\]")
let R=$RANDOM%16+0
color=${colors[$R]}
prompt="${color}\u@\h:\w\$\[\e[0m\] "
# the prompt
PS1=$prompt
Thanks.
Last edited by orph (2009-03-01 16:10:57)
I KISS you.
Offline
You could use the PROMPT_COMMAND:
colors=("\[\e[0;30m\]" "\[\e[0;34m\]" "\[\e[0;32m\]" "\[\e[0;36m\]" "\[\e[0;31m\]" "\[\e[0;35m\]" "\[\e[0;33m\]" "\[\e[0;37m\]" "\[\e[1;30m\]" "\[\e[1;34m\]" "\[\e[1;32m\]" "\[\e[1;36m\]" "\[\e[1;31m\]" "\[\e[1;35m\]" "\[\e[1;32m\]" "\[\e[1;37m\]")
PROMPT_COMMAND='let R=$RANDOM%16+0;color=${colors[$R]};PS1="${color}\u@\h:\w\$\[\e[0m\] "'
Offline
Thanks!
I KISS you.
Offline