How To
Summary
How to add color to the KSH or CSH shell environment
Objective
Steps
Where <NUM> is one of:
Foreground:
30 Black
31 Red 32 Green 33 Yellow 34 Blue 35 Magenta 36 Cyan 37 White Background:
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White
0 Reset all
1 Bold
|
csh:
set e="`echo x | tr x '\033'`"
set red="${e}[31m"
set green="${e}[32m"
set yellow="${e}[33m"
set blue="${e}[34m"
set magenta="${e}[35m"
set cyan="${e}[36m"
set white="${e}[37m"
set end="${e}[0m"
set prompt="${cyan}${LOGNAME}${blue}@`hostname`:${magenta}`pwd`> ${end}"
|
The syntax can be changed for ksh by replacing 'set' with 'export', and replacing 'prompt' with 'PS1'.
ksh:
export e="`echo x | tr x '\033'`"
export red="${e}[31m"
export green="${e}[32m"
export yellow="${e}[33m"
export blue="${e}[34m"
export magenta="${e}[35m"
export cyan="${e}[36m"
export white="${e}[37m"
export end="${e}[0m"
export PS1="${cyan}${LOGNAME}${blue}@`hostname`:${magenta}`pwd`> ${end}"
Tweak the syntax to suit your requirements. For example , use '@${HOSTNAME}' instead of @`hostname` if HOSTNAME is defined in your environment) export PS1="${cyan}${LOGNAME}${blue}@${HOSTNAME}:${magenta}$PWD> ${end}" |
Additional Information
SUPPORT |
---|
If you require more assistance, use the following step-by-step instructions to contact IBM to open a case for software with an active and valid support contract. 1. Document (or collect screen captures of) all symptoms, errors, and messages related to your issue. 2. Capture any logs or data relevant to the situation. 3. Contact IBM to open a case: -For electronic support, see the IBM Support Community: 4. Provide a clear, concise description of the issue. - For guidance, see: Working with IBM AIX Support: Describing the problem. 5. If the system is accessible, collect a system snap, and upload all of the details and data for your case. - For guidance, see: Working with IBM AIX Support: Collecting snap data |
Related Information
Was this topic helpful?
Document Information
Modified date:
14 June 2022
UID
ibm16326209