The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Specifying font type and color in a shell script Vani_Govind Shell Programming and Scripting 4 03-13-2008 03:42 AM
Font size in VIM ketchera UNIX for Dummies Questions & Answers 1 02-19-2008 08:29 AM
set font size sachin.gangadha UNIX for Dummies Questions & Answers 14 12-13-2007 05:50 PM
Modify Print Orientation, Font and Pitch mad_dog AIX 2 07-24-2006 05:41 AM
Font size elhefe UNIX for Dummies Questions & Answers 2 11-05-2001 02:18 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2008
Registered User
 

Join Date: Feb 2008
Posts: 2
Question how to modify font size and type from script

I need to print different lines in different font types and sizes to the terminal window from csh script. I can easily change font color and print characters in bold or underline, but cannot figure out a way to change font. Any help is greatly appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 02-06-2008
Registered User
 

Join Date: Jan 2008
Posts: 14
I am intrested to know

I am intrested to know how you change colour and change it bold ..or underline ??
Reply With Quote
  #3  
Old 02-07-2008
Registered User
 

Join Date: Feb 2008
Posts: 2
printing color/bold

To change the color from the script or the command line, you execute command in the following format: echo "<esc>[<color>m <string>", where
<esc> is an escape character (Ctrl+V), followed by a bracket [, followed by a color code (see below), followed by letter m, followed by a string to print. Color codes for foreground are as follows: 30 (black), 31 (red), 32 (green), 33 (yellow), 34 (blue), 35 (magenta), 36 (cyan), and 37 (gray). For backgrounds color codes are the same, except instead of 3, they start with 4. They can be mixed and matched. Bold is 1, underlined is 4. For csh shell, I actually had to use vi editor and enter Ctrl+V to have that character recorded, bracket follows right after, letter m is necessary after the color code to end the escape sequence. In other shells, \033 or \E can work instead of using Ctrl+V. Here is a complete example:
echo "<esc>[34m I am in blue" or echo "<esc>[1m I am in bold". I hope this helps.
Reply With Quote
  #4  
Old 02-08-2008
Registered User
 

Join Date: Sep 2007
Location: Poland
Posts: 63
Actually you should read about ANSI colors.
To make a bold/standout/invert/underline/blink/... text you could use 'tput'.
The terminals could support different number of colors (I use PuTTY with 256 colors support). Support for bold/standout/blink/etc. depends on the terminal capabilities as well.
This is possible to switch to "alternative font". You should google for the characters sequence.
This is possible as well to display "upper half" and "lower half" of a letter (so you could get characters that are 2x larger).
All the time remember that it require terminal caps and you should not use it when you don't have that caps supported.
As for the colors: If the terminal can handle 16 colors then you should be able to use: <ESC>[XX;YY;ZZm sequence (<ESC> is \033 is 27 is \e and it is the escape character/sequence). Correct numbers could tell to use some color/caps. Ex. \033[48;5;187m is (possibly I mixed up this one blue color bolded text on gray-yellow background on 256-colors terminal.
Some examples:
Forecolor Red: \033[31m
Forecolor Blue: \033[34m
Backcolor Yellow: \033[43m
Blink: $(tput blink)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:22 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0