Publi

Colores para stdin y stderr

Esto fue parte de un experimento que hice, se trata de conseguir que tras la ejecución de un comando la salida estándar del mismo se representara en color verde en mi terminal y la salida de error en color rojo (por supuesto podemos dejar sólo la salida de error en rojo), pero el hecho es demostrar que estos dos tipos de salida existen y hay forma de distinguirlas:

$ comando 2> >(while read line; do echo -e «\e[01;31m$line\e[0m»; done) 1> >(while read line; do echo -e «\e[01;32m$line\e[0m»; done)

En negrita está la redirección para la salida de error, y en cursiva la redirección para la salida estándar. La hemos hecho con códigos ANSI, y podemos encontrar una referencia de colores en: Colores y posicionamiento en terminales Linux (como conio.h en DOS)
.

Aunque como una referencia rápida incluiré: 31 rojo, 32 verde, 33 amarillo, 34 azul, 35 magenta, 36 cyan, 37 blanco. Y éste será el color a incluir en: echo -e «\e[01;32m$line\e[0m»;

También podría interesarte....

There are 9 comments left Ir a comentario

  1. Pingback: Bitacoras.com /

  2. ufa656 /
    Usando Google Chrome Google Chrome 120.0.0.0 en Windows Windows NT

    I’d state which this can be a an excellent publish of the excellent individual, i am very happy to observe this particular. ufa656

  3. MUZAMMIL SEO MUZAMMIL SEO /
    Usando Google Chrome Google Chrome 121.0.0.0 en Windows Windows NT

    I merely imagined it usually is a perception to write could possibly help anybody ended up being experiencing difficulity looking into nevertheless We are somewhat doubtful only are permitted to placed labels along with details in below. транспорт на кола от германия цена

  4. alam alam /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    The kitchen is usually a critical living space in a property, where by dinners are ready in addition to remembrances are designed. It is just a switch connected with pastime, typically portion for the reason that cardiovascular system entrance. Some sort of well-designed kitchen’s can certainly enhance the efficiency in addition to good looks of any property, turning it into an increasingly fulfilling in addition to productive destination to make meals in addition to obtain. Stella

  5. abdul moeez /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    Searching any talent for gardeners magnifies well-being by just encouraging a good more intense experience of aspect. Gardeners gives the our world meant for mind and body, advertising and marketing comfort together with mindfulness. Thru nurturing factories, an individual cultivates determination together with resilience. Adopt any curing primary advantages of gardeners that will improve your lifestyle together with conditions holistically. https://hotandbestdeals.com

  6. yitzchak kerrigan /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    This is exactly for that reason fabulous and additionally extremely creative. I simply absolutely love all the different shades and additionally anyone can get the software on the deliver would be happy. buy oxycodone online

  7. yitzchak kerrigan /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    Keep up to date the nice deliver the results, I actually learn very few discussions during this webpage plus There’s no doubt that that your chosen website site is definitely serious helpful and has now became encircles with brilliant information and facts. łóżko dla dziewczynki

  8. ghori92 /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    Regards just for featuring brand-new upgrades in connection with priority, Document wait for look at a great deal more. andractim gel for sale

  9. yitzchak kerrigan /
    Usando Google Chrome Google Chrome 122.0.0.0 en Windows Windows NT

    Literally Document look at the software yesterday evening still I had produced a lot of emotions relating to this now I needed to read the software once as it is relatively well crafted. Deneme Bonusu

Leave a Reply