On Sun 01 Sep 2019 at 17:53:51 (+0200), Computer Planet wrote: > Hi guys! > I'm trying, trying and trying but... > > How I Can put in hte end of a bash script this command: > PS1="\[\e]0;\u@\h: > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w > #\[\033[91m\] " > so that after finishing the script the prompt will write in red...? > > If I try in prompt # PS1="\[\e]0;\u@\h: > \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w > #\[\033[91m\] " > command no problem, write in red until exit or reboot.
Rather than figure out what exactly you're putting into your bash prompt, I'll just post mine, for my host that uses red, and let you pick out anything you want. Localcolor comes from a separate subfile. The warning is to remind me that PS1 should be set at the *end* of .bashrc because some of the subfiles identify themselves if PS1 is set. But you don't want any output generated from those subfiles, though, if .bashrc is running to initialise a non-interactive shell. The extra xterm item is for labelling xterm's title bars. --✄-------- Localcolor='\e[0;31m' # red ################################################################### # Don't change PS1 until after this point because its empty value # # prevents sourced files from writing output when non-interactive # ################################################################### # tty in the title bar makes it easier to kill an xterm should it freeze. export PROMPT_COMMAND='Myprompt="$? " && [ "$Myprompt" = "0 " ] && Myprompt=""' case "$TERM" in *xterm*) export PROMPT_COMMAND+=" ; printf '%b' '\e]0;${HOSTNAME^^} $(tty) ${HOSTNAME^^}\a'" ;; esac export PS1='\[\e[1;33;41m\]$Myprompt\[' export PS1+="$Localcolor" export PS1+='\]\H!\u \t \w \$ \[\e[m\]' unset Localcolor --✄-------- Cheers, David.