Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Changing korn shell script text Menu colors? Post 11891 by PxT on Thursday 13th of December 2001 01:28:13 PM
Old 12-13-2001
Assuming your terminal supports ANSI colors, it is quite easy. You just need to add certain echo statements to achieve certain colors.

The syntax is: echo "^[[#m<text>"

Where the the "^[" character is produced by hitting ctrl-v and then escape and # is substituted with a number depending on the effect you want the second "[" and the "m" are literal characters. Here's an excerpt from some C code listing the various colors (because I'm too lazy to retype it in a different format):

Code:
/* foreground colors */
#define AFC_BLACK           30
#define AFC_RED             31
#define AFC_GREEN           32
#define AFC_YELLOW          33
#define AFC_BLUE            34
#define AFC_MAGENTA         35
#define AFC_CYAN            36
#define AFC_WHITE           37

/* ansi background colors */
#define ABC_BLACK           40
#define ABC_RED             41
#define ABC_GREEN           42
#define ABC_YELLOW          43
#define ABC_BLUE            44
#define ABC_MAGENTA         45
#define ABC_CYAN            46
#define ABC_WHITE           47


/* ansi modes */
#define AM_NORMAL               0         
#define AM_BOLD                 1
#define AM_LOWINTESITY          2
#define AM_ITALIC               3
#define AM_UNDERLINE            4
#define AM_BLINK                5
#define AM_RAPIDBLINK           6
#define AM_REVERSE              7
#define AM_INVISIBLE            8

You can combine the modes, so to print the word "hello" in yellow text on a blue background and then return to normal you would use:

echo "^[[33m^[[44mhello^[[0m"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Changing a CSV file in Korn shell

Hi All, Please can someone help me how I can read a CSV file with 10 columns and remove the 2nd, 4th, 6th, 8th column and build the new output file. Script to be done in Korn shell. File contains data like bnt, lb2, lb3, vnw, lb4, lb5, bst, lb6, lb7, vgw (multiple rows) Output file should... (2 Replies)
Discussion started by: riteshm
2 Replies

2. UNIX for Dummies Questions & Answers

changing the colors of nedit

I have only slight difference between remarks (gray) and code (black) using c and c++ how cani change remark to other color ? The option preferences/language mode/c++ doesn't help (0 Replies)
Discussion started by: eynkesef
0 Replies

3. Shell Programming and Scripting

How to: Parse text string into variables using Korn shell

I am writing a script to keep check on free disk space, and I would like to find a way to parse $LINE (see code below) into a numeric value (for free disk space percentage) and a string value (for mount point). If possible, I would like to avoid sed or any additional use of awk since I am not very... (7 Replies)
Discussion started by: shew01
7 Replies

4. Solaris

Changing CDE FrontPanel Button Colors

OK so I've been trying to figure this out on and off for about two years on Solaris 8, and now I'm trying to do it in Solaris 10 (which seem to have identical resource structures for Dtwm.) I've created my own sleek, single row front panel with small custom icons, and smaller font so that it's... (1 Reply)
Discussion started by: insamniac
1 Replies

5. OS X (Apple)

Changing OSX Terminal Man Page Colors

For a long time, when I type man anything on my Mac, both the manpage header fonts and the background was black, so I had to use my mouse to highlight the manpage output to read it. It was really annoying. The problem was the same both locally or using the terminal and going ssh somewhere. ... (1 Reply)
Discussion started by: Neo
1 Replies

6. Shell Programming and Scripting

shell script for changing two text files

HELLO I am new in shell bash script> I have two text files.They contain same datas. I want to change some text in two files.If I changed in one file.Then I want to change another same file without using vieditor.Iwant to change another file by using shell script for example file1 hello good... (7 Replies)
Discussion started by: vidhun.v
7 Replies

7. UNIX for Advanced & Expert Users

Changing colors for compiler errors/warnings

Hi, I am using GNU unix. And running a bash shell. Can anyone please tell me what is the command for changing the color of the compiler error/warning messages on the console. I think it is in .bashrc and do not know how. Thanks Pink (0 Replies)
Discussion started by: pink01
0 Replies

8. UNIX for Dummies Questions & Answers

Changing colors for compiler errors/warnings

Hi, I am using GNU unix. And running a bash shell. Can anyone please tell me what is the command for changing the color of the compiler error/warning messages on the console. I think it is in .bashrc and do not know how. Thanks Pink (1 Reply)
Discussion started by: pink01
1 Replies

9. Shell Programming and Scripting

Change text color in Korn shell to highlight Error

Hi this is my first post, so forgive me if what I'm requesting doesn't make sense. I'm connecting into a Unix server via SSH and using a Korn Shell (#!/bin/ksh). The Unix server has Oracle 11g installed on it and there are a number of scripts already setup to query the Oracle database to perform... (2 Replies)
Discussion started by: KeithJ
2 Replies

10. Shell Programming and Scripting

Script to call a menu script and redirect each option to a text file

Hello, I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file. For example;- In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Discussion started by: spradha
4 Replies
brlapi_keycodes.h(3)						      BrlAPI						      brlapi_keycodes.h(3)

NAME
brlapi_keycodes.h - SYNOPSIS
#include 'brlapi_constants.h' Macros #define BRLAPI_PRIxKEYCODE PRIx64 #define BRLAPI_PRIuKEYCODE PRIu64 #define BRLAPI_KEY_MAX UINT64_C(0XFFFFFFFFFFFFFFFF) #define BRLAPI_KEY_FLAGS_MASK UINT64_C(0XFFFFFFFF00000000) #define BRLAPI_KEY_FLAGS_SHIFT 32 #define BRLAPI_KEY_FLG(v) ((brlapi_keyCode_t)(v) << BRLAPI_KEY_FLAGS_SHIFT) #define BRLAPI_KEY_FLG_MOD1 BRLAPI_KEY_FLG(0x00000008) #define BRLAPI_KEY_FLG_MOD2 BRLAPI_KEY_FLG(0x00000010) #define BRLAPI_KEY_FLG_MOD3 BRLAPI_KEY_FLG(0x00000020) #define BRLAPI_KEY_FLG_MOD4 BRLAPI_KEY_FLG(0x00000040) #define BRLAPI_KEY_FLG_MOD5 BRLAPI_KEY_FLG(0x00000080) #define BRLAPI_KEY_TYPE_MASK UINT64_C(0X00000000E0000000) #define BRLAPI_KEY_TYPE_SHIFT 29 #define BRLAPI_KEY_TYPE_CMD UINT64_C(0X0000000020000000) #define BRLAPI_KEY_TYPE_SYM UINT64_C(0X0000000000000000) #define BRLAPI_KEY_CODE_MASK UINT64_C(0X000000001FFFFFFF) #define BRLAPI_KEY_CODE_SHIFT 0 #define BRLAPI_KEY_CMD_BLK_MASK UINT64_C(0X1FFF0000) #define BRLAPI_KEY_CMD_BLK_SHIFT 16 #define BRLAPI_KEY_CMD_ARG_MASK UINT64_C(0X0000FFFF) #define BRLAPI_KEY_CMD_ARG_SHIFT 0 #define BRLAPI_KEY_CMD(v) ((v) << BRLAPI_KEY_CMD_BLK_SHIFT) #define BRLAPI_KEY_SYM_BACKSPACE UINT64_C(0X0000FF08) #define BRLAPI_KEY_SYM_TAB UINT64_C(0X0000FF09) #define BRLAPI_KEY_SYM_LINEFEED UINT64_C(0X0000FF0D) #define BRLAPI_KEY_SYM_ESCAPE UINT64_C(0X0000FF1B) #define BRLAPI_KEY_SYM_HOME UINT64_C(0X0000FF50) #define BRLAPI_KEY_SYM_LEFT UINT64_C(0X0000FF51) #define BRLAPI_KEY_SYM_UP UINT64_C(0X0000FF52) #define BRLAPI_KEY_SYM_RIGHT UINT64_C(0X0000FF53) #define BRLAPI_KEY_SYM_DOWN UINT64_C(0X0000FF54) #define BRLAPI_KEY_SYM_PAGE_UP UINT64_C(0X0000FF55) #define BRLAPI_KEY_SYM_PAGE_DOWN UINT64_C(0X0000FF56) #define BRLAPI_KEY_SYM_END UINT64_C(0X0000FF57) #define BRLAPI_KEY_SYM_INSERT UINT64_C(0X0000FF63) #define BRLAPI_KEY_SYM_FUNCTION UINT64_C(0X0000FFBE) #define BRLAPI_KEY_SYM_DELETE UINT64_C(0X0000FFFF) #define BRLAPI_KEY_SYM_UNICODE UINT64_C(0X01000000) Typedefs typedef uint64_t brlapi_keyCode_t Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Mon Apr 1 2013 brlapi_keycodes.h(3)
All times are GMT -4. The time now is 05:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy