🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #7344

Re: Aplicando colores a bash.

#7344
From: Iago Rubio
Date: Sun, 09 Mar 2003 20:55
36 lines
2241 bytes
Estaba Juan Ortiz por es.comp.os.linux.programacion y escribio:

> Saludos colisteros,
> Como puedo hacer para aplicar colores a texto de scirpts realizados en
> bash  .... [texto eliminado] ... algo debo estar haciendo mal
> porque no resulta.

Yo lo que hago es guardar los c�digos de color en variables y me resulta.


#!/bin/bash
# Colores
NORMAL="\033[0m"
VERDE=$'\e[32;01m'
AMARILLO=$'\e[33;01m'
ROJO=$'\e[31;01m'
NORMAL=$'\e[0m'
NEGRITA=$'\e[30;01m'
AZUL=$'\e[34;01m'

echo " ${ROJO}-----------------------------------------------"
echo "         !!! Aviso estoy en rojo !!!"
echo "     panic,  panic pulse Ctr + Alt + Supr       "
echo "                  para continuar"
echo " -----------------------------------------------${NORMAL}"
echo "Ahora ya estoy normal ${VERDE} aunque me pongan verde"
echo -n "${NORMAL}Tambien puedes ${NEGRITA} resaltar ${NORMAL}"
echo "o ir de ${VERDE}RAS${AMARILLO}TA${ROJO}FA${VERDE}RI${NORMAL}"

Bueno co�as aparte espero que te ayude :-)

Recuerda que los nombres de las variables son nemotecnicos que pongo para 
usarlos m�s facilmente (${NORMAL} es un negro por ejemplo).
-- 
Iago Rubio                     < iago.rubio(EN)hispalinux.net >
Linux User # 280230       RH 8.0 Kernel 2.4.18smp
Technical Details
Message-ID: <b4g9m3$1uveot$1@ID-175868.news.dfncis.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fu-berlin.de!uni-berlin.de!120.red-80-36-158.pooles.rima-tde.NET!not-for-mail
References: <slrnb6mtr4.1v3.juan_ortiz@KaOs.net>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,3daa8a1e6a154322
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-03-09 12:54:29 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fu-berlin.de!uni-berlin.de!120.red-80-36-158.pooles.rima-tde.NET!not-for-mail
From: Iago Rubio <iagorubio@yahoo.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Aplicando colores a bash.
Date: Sun, 09 Mar 2003 21:55:01 +0100
Organization: Hola a tooodos ;-)
Lines: 37
Message-ID: <b4g9m3$1uveot$1@ID-175868.news.dfncis.de>
References: <slrnb6mtr4.1v3.juan_ortiz@KaOs.net>
NNTP-Posting-Host: 120.red-80-36-158.pooles.rima-tde.net (80.36.158.120)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
X-Trace: fu-berlin.de 1047243267 66042653 80.36.158.120 (16 [175868])