Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-WebMail-UserID: pjacklam AT online DOT no Date: Thu, 29 Jan 2004 15:50:27 +0100 From: "Peter J. Acklam" To: cygwin , gobo AT gobo-net DOT de X-EXP32-SerialNo: 50000140 Subject: RE: csh color codes Message-ID: <401C1463@epostleser.online.no> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes > > I am running the latest Cygwin on my Win2k and I'm using csh as > the standard shell. The color mode for XTerm is enabled and > works fine, e.g. with "ls --color". > > However I have a problem to figure out how to generate the > appropriate control (escape) sequences to included colors in > shell script outputs. I have some shell scripts here which > originate from a HP-UX based csh. There, the escape sequences > are generated by pressing "Ctrl + V" + "Esc" + "[" + 'code', > where 'code' is e.g. "1m" for bold or "32m" for green (= > ^[[32m). However, these codes don't work within the Cygwin-csh. > > Does anyone know the correct sequences here? Why not use printf and \033 for the escape character? The following prints "xxx yyy zzz" where "yyy" is green: printf 'xxx \033[32myyy\033[m zzz' Here is a list showing other escape sequences # foreground colours printf '\033[30m black \033[m' printf '\033[31m red \033[m' printf '\033[32m green \033[m' printf '\033[33m yellow \033[m' printf '\033[34m blue \033[m' printf '\033[35m magenta \033[m' printf '\033[36m cyan \033[m' printf '\033[37m white \033[m' # background colours printf '\033[40m black \033[m' printf '\033[41m red \033[m' printf '\033[42m green \033[m' printf '\033[43m yellow \033[m' printf '\033[44m blue \033[m' printf '\033[45m magenta \033[m' printf '\033[46m cyan \033[m' printf '\033[47m white \033[m' # other printf '\033[0m default \033[m' printf '\033[1m bold \033[m' printf '\033[2m faint \033[m' printf '\033[3m italic \033[m' printf '\033[4m underlined \033[m' printf '\033[5m slowblink \033[m' printf '\033[6m rapidblink \033[m' printf '\033[7m negative \033[m' Peter -- Peter J. Acklam - pjacklam AT online DOT no - http://home.online.no/~pjacklam -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/