Subject: Re: aliasing the newline-/return-char
To: Martin Ammermueller <martin81@bnro.de>
From: Julian Coleman <jdc@coris.demon.co.uk>
List: netbsd-users
Date: 04/23/2001 12:11:01
Martin Ammermueller wrote:
> I've started to use the (pd)ksh this weekend
> and I wonder if it's possible to alias
> the ^M (Return|Newline)-character?
>
> Background: I want to coloring the command-line
> and the programm-output in a different color...
Can you not set $PS1 to something to achieve the same affect? Assuming an
xterm/vt100, you could do :
_hostname=`hostname`
_user=`whoami`
export PS1="^[[1m$_hostname:$_user $^[[m "
in your $HOME/.profile to get the prompt in bold. The "^[" sequence is the
escape character - you can enter this with <ctrl-V>, then <escape>.
These escape sequences are the ones that (for example) the curses library
uses to maniplulate the screen. If you look at /usr/share/misc/termcap and
the manual page termcap (5) and look at the m? values for bold/reverse/etc.
and the AB/AF values for background and foreground, you can set various
combinations. For example, for our xterm (which is derived from the
xterm-xf86-v32 and xterm-xf86-v33 entries) :
export PS1="^[[31;43m$_hostname:$_user $^[[m "
would give red on yellow text for the prompt.
J
PS. You can also try the combinations by using printf , e.g.
printf "\033[31;43m$_hostname:$_user $\033[m "
PPS. For csh, use `set prompt=` instead of `export PS1=`.
--
My other computer also runs NetBSD
http://www.netbsd.org/