View Single Post
Old 4th December 2009
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

I always set my prompt to 'username@hostname-$ ' where the $ is colour coded based on the shell and the host. I find it helps me remember which machine I'm typing at, and the colored dollar sign for when I'm about to pass out.


Getting colour prompts to work without getting annoyed at different ksh implementations, resulted in this in my ~/.${LOGNAME}_shrc:

Code:
 #
             # The various korn shells handle escape codes in prompts
             # rather differently from one another. This method appears
             # to work on all ksh implementations and plays nicely with
             # VT102 emulators like rxvt perfectly fine.
             #
             # Special thanks to Scotto for this technique.
             #
             PS1='^[^M${USER}@^[[1;37m${HOSTNAME}^[[0;36m$^[[0;0m '
and is only executed for the ksh family. The odd control characters being created with control+v followed with the suitable character.


OpenBSDs implementation seems to be the best for getting a colour prompt, without aggravation. My profile however.... covers most forms of Bourne shell in script.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote