Web hosting script - 2: SOMEUSEFULTPUTSEQUENCESSequenceWhat You Use It Fortput sgr0Reset all
2: SOMEUSEFULTPUTSEQUENCESSequenceWhat You Use It Fortput sgr0Reset all formatting. tput boldDisplay text in bold font. tput revDisplay inverse-colored text (white on blackinstead of black on white, for example). tput smulStart underlining text. tput rmulStop underlining text. tput setafSet foreground color. tput setabSet background color. These are your choices for foreground and back- ground colors: 0Black1Red2Green3Yellow4Blue5Magenta6Cyan7WhiteJust find the color you want to use and stick it at theend of the tput setafor tput setabcommand. You can combine the different text effects to producecolored and underlined prompts, boldface inversefonts, and any combination of your terminal supports. For example, you can display an underlined blueprompt: [freddie@bastille] BLUE= \[$(tput setaf4)\] [freddie@bastille] ULINE= \[$(tput smul)\] [freddie@bastille] RESET= \[$(tput sgr0)\] [freddie@bastille] PS1= $BLUE$ULINE[\ u@\h]$RESET [freddie@bastille] Notice that we used tput sgr0to restore the textback to its normal state (default color, no underline, no bold). That s usually a good idea when you usetputto customize your prompt. Otherwise, what- ever you type in after the colorized prompt will becolorized as well. Seeing a Red Alert When YouHave Superuser PrivilegesWe mention earlier in this technique that we canshow you a better way to remind yourself that youhold dangerous superuser privileges. The typicalway to distinguish between superuser status andmere-mortal status is to change one character inyour prompt (usually the last character) from $to #. But that s a pretty small change and can easily gounnoticed. Superuser privileges are dangerous:onemistake, and you re looking at hours of cleanup. Here s a way to make your privilege level jump outatyou: When you hold superuser privileges, yourprompt is displayed in red, and when you don t, your prompt is displayed in blue. The followingsteps explain how to make this change: 1.Open a terminal window and give yourselfsuperuser privileges with the sucommand. $ suPassword: # su2.Open the /etc/bashrcfile in your favoriteeditor. # kedit /etc/bashrcIf you prefer GNOME, you can use geditinstead: # gedit /etc/bashrcIf you re using SuSE, modify the/etc/bash.bashrc.localfile. If the filedoesn t already exist, it is automaticallycreatedwhen you save your changes.
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.