ausgabefarbe ändern

oyster-manu

oyster-manu

toast
wie kann man in einem shellscript die ausgabefarbe ändern?

zb. soll

echo "grün"

ein grünes "grün" ausgeben.
 
Das geht mit EscapeSequenzen.
PS1='\033[1;33m[\W]\033[0m Das ist mein Prompt.
in Gelb [WORKINGDIR] und dann wieder alles normal.
D.H. du kannst für eine Ausgabe die Schrift auf grün machen und dann wieder auf Standard.

Leider weiß ich die EscapeNummer für grün jetzt nicht, aber bei google wirst du 100pro fündig!
 
Bitte Boardsuche benutzen, das hatten wir schon mal!

Code:
   ECMA-48 Set Graphics Rendition
       The ECMA-48 SGR sequence ESC [ <parameters> m sets display  attributes.
       Several attributes can be set in the same sequence.


       par   result
       0     reset all attributes to their defaults
       1     set bold
       2     set half-bright (simulated with color on a color display)
       4     set underscore (simulated with color on a color display)
             (the colors used to simulate dim or underline are set
             using ESC ] ...)
       5     set blink
       7     set reverse video
       10    reset selected mapping, display control flag,
             and toggle meta flag.
       11    select null mapping, set display control flag,
             reset toggle meta flag.
       12    select null mapping, set display control flag,
             set toggle meta flag. (The toggle meta flag
             causes the high bit of a byte to be toggled
             before the mapping table translation is done.)
       21    set normal intensity (this is not compatible with ECMA-48)
       22    set normal intensity
       24    underline off
       25    blink off
       27    reverse video off
       30    set black foreground
       31    set red foreground
       32    set green foreground
       33    set brown foreground
       34    set blue foreground
       35    set magenta foreground
       36    set cyan foreground
       37    set white foreground
       38    set underscore on, set default foreground color
       39    set underscore off, set default foreground color
       40    set black background
       41    set red background
       42    set green background
       43    set brown background
       44    set blue background
       45    set magenta background
       46    set cyan background
       47    set white background
       49    set default background color
Quelle: man console_codes
 

Ähnliche Themen

Wie vom Script verwendete Befehle ermitteln um sie bei Bedarf nach zu installieren?

Returncode ($?) bei find immer "0" ?

Switche abfragen über Script

Verzeichnis mit 1200 Dateien auf Verweise in Textdateien checken

Script pausieren bis Bedingung erfüllt ist

Zurück
Oben