Cshell help with change colour in print


 
Thread Tools Search this Thread
Top Forums Programming Cshell help with change colour in print
# 1  
Old 03-01-2011
Cshell help with change colour in print

i want to ask how to change the colour of prompt message from use?
and also how to change colour in printing........

i want to change it as blue colour and red colour, but i found many website still don't know how to do. how's the command is wrote?

thz really!!
# 2  
Old 03-01-2011
This might only work for tcsh, but I have this in my /etc/csh.cshrc:
Code:
set prompt = "%{\033[0;1;34m%}(%{\033[0;1;31m%}%m%{\033[0m%}:%{\033[0;1;34m%}%c3%{\033[0;1;34m%}) %{\033[0;1;31m%}%#%{\033[0m%} "

...which sets a color prompt. This is how it works:

Code:
"%{\033[0;1;34m%}

The %{...%} stuff seems necessary to print raw escape characters, otherwise it prints ^[ instead of ESC. So this ends up printing the escape sequence for high-intensity blue.

This works only in the prompt variable though. To get a raw ESC somewhere else you have to printf it, you can't echo it.

Code:
printf "\033[0;1;34m%The following text should be blue\033[0m"

The first bit sets it blue, the second bit resets it to defaults. See ASCII Table - ANSI Escape sequences for possible numbers for the 'set graphics mode' command, you can string them in a line like "0;1;34" for "reset defaults", "high intensity", "blue". Add the head and tail and you get \033[0;1;34m
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed colour change

Hi, I am trying to write a script which will email a backup report from the server, The contents of the email will be: ---------------------- ---- -- ---- ----- ---- ------- ---- ------- ------- | | | | |Chnge|Wkng| | | | | | ... (6 Replies)
Discussion started by: Bdoydie
6 Replies

2. AIX

putty background colour change in vi editor

Hello, I have a problem with my putty session when i use the vi editor or when i do dbaccess on an Informix database. Suddenly the background and foreground colour of my terminal change and it makes it difficult for me to see whats on the screen. Why this is happening? Is there a way to keep... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

3. Shell Programming and Scripting

How to change a number on a specific line with cshell or shell?

Hello all, I need to change a number in a file by adding some residuals respectively To make it clear, I need to add 0.11 to the number between 24-28 (which is below the SECON) for all the lines starting with FRR1 or I need to add 0.13 to the number between 24-28 (which is below the... (9 Replies)
Discussion started by: miriammiriam
9 Replies

4. SCO

Why? I can not change the number of lines to print

hi My problem now is that if shipping options as -o length = 88 it says the following: # lp -o length=88 -dhp4015 /etc/hosts UX:lp: ERROR: The following options can't be handled: -o length= TO FIX: The printer(s) that otherwise qualify for printing your request can't handle one or more of... (2 Replies)
Discussion started by: Edgar Guevara
2 Replies

5. UNIX for Advanced & Expert Users

To change the colour of the content in email sent through unix

Hi I want to change the color of the email content sent through unix. I tried a lot and left in vain. I heard that it could be done by sending the email as HTML. But I don't how to do it. Can you all share your ideas? ~sakthifire (1 Reply)
Discussion started by: sakthifire
1 Replies

6. Programming

Change Pseudo Code to C Program (print and fork)

I am very new at programming and this is probably an easy question, but I am desperate. I need to change this low level code into a C program that I can run so I can print out every "A" that appears with the fork() command. You help is greatly appreciated. PRINT A p=fork() if( p == 0) {... (0 Replies)
Discussion started by: tpommm
0 Replies

7. HP-UX

hpux top colour

Hello, is there some way to change b/w colour of top command output in hpux B.11.31 ? (1 Reply)
Discussion started by: tonijel
1 Replies

8. HP-UX

How to change font and colour in mail sent from Unix

Dear All, We have following code to send mails from unix to users. We want to see few sentences of mail in bold font or to hightlight few lines in different colours. Could you please let me know how can we do it in function construct_body. ... (3 Replies)
Discussion started by: yogichavan
3 Replies

9. Shell Programming and Scripting

How to change the font colour in unix ?

Could you pls tell me how to change the font colour in unix ? What is the syntax ? (3 Replies)
Discussion started by: sars
3 Replies

10. UNIX for Dummies Questions & Answers

HOw to change the text colour through shell script?

Hi all, I have written one script. If i run the script, particular text in that script needs to be displayed in color.how this could be done?any commands r there to change the colour of the text while running the script? Ur help is appreciated !!! Thanx in Advance, Sona. (7 Replies)
Discussion started by: Sona
7 Replies
Login or Register to Ask a Question