coloring the ksh prompt - BSD

This is a discussion on coloring the ksh prompt - BSD ; Hi, Is it possible to use colors at the "ksh" prompt? I'm not talking about colorsls. For example here is my prompt: PS1='\u@\h:\w$ ' Now, how do I color "ONLY" the user (\u) in red at the prompt? thanks a ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: coloring the ksh prompt

  1. coloring the ksh prompt

    Hi,

    Is it possible to use colors at the "ksh" prompt?

    I'm not talking about colorsls.

    For example here is my prompt:
    PS1='\u@\h:\w$ '
    Now, how do I color "ONLY" the user (\u) in red at the prompt?

    thanks a lot
    didier



  2. Re: coloring the ksh prompt

    "didier" wrote:
    > Is it possible to use colors at the "ksh" prompt?
    >
    > I'm not talking about colorsls.
    >
    > For example here is my prompt:
    > PS1='\u@\h:\w$ '
    > Now, how do I color "ONLY" the user (\u) in red at the prompt?


    PS1='\e[1;31m\u\e[0m@\h:\w$ '

    Google for ANSI escape sequences.

    You may want to look at ksh's \[ and \] also.



  3. Re: coloring the ksh prompt

    didier wrote:

    > For example here is my prompt:
    > PS1='\u@\h:\w$ '
    > Now, how do I color "ONLY" the user (\u) in red at the prompt?


    PS1="\[$(tput setaf 1)\]\u\[$(tput op)\]@\h:\w\$ "

    --
    Christian "naddy" Weisgerber naddy@mips.inka.de

  4. Re: coloring the ksh prompt

    thanks a lot!!!



+ Reply to Thread