0

I have learned about formatting options used in shell scripting, which go like this:

\033[37:40mAnyText\033[0m

Now I want to echo some text like this:

echo -e "SomeText \033[5;31;47mMoreText\033[0m"

The integer 5 is for blinking. The other formatting works, but not the blinking -- why?

  • 1
    Probably your terminal doesn't support blinking. – jimmij May 26 '16 at 11:34
  • @jimmij really? And how can I find if it's the case? – Sollosa May 26 '16 at 11:36
  • 1
    In principle you can look at infocmp to see terminal capabilities. However if you are using vte-based terminal (like gnome or terminator) then it reports itself as xterm, what is not true. – jimmij May 26 '16 at 12:31
  • 4
    Why? Because your terminal's author a) is trying to save you from having to gouge your eyes out; and b) does not want to be lynched. That's why. – cas May 26 '16 at 12:49
3

This is a terminal independent way of enabling the blinking attribute. If it doesn't work then either you've mis-set your terminal type, it's not enabled in the terminal characteristics, or it's simply not supported:

tput blink
echo hello, world
tput sgr0

The terminfo database is well worth perusing (not bedtime reading, mind) to find semi-readable names for terminal escape code sequences.

  • 2
    On second thoughts, if you want to foist blinking text on your users you should also be forced to endure the horrors of embedded escape sequences. With no code comments. – roaima May 26 '16 at 15:29
0

I find that gnome-terminal and its close relative mate-terminal don't support blink, but xterm does, at least partially. Even then, it only supports slow blink (code 5, not 6) and the text only blinks while the window has focus.

  • 1
    gnome-terminal will support blinking text as of version 3.28 (and so will mate-terminal and other VTE-based emulators with VTE version 0.52), to be released in March 2018. Only "code 5", not 6. In gnome-terminal it'll be configurable whether the text should be blinking in focused as well as unfocused terminals. mate-terminal and friends can also easily add such a config option too. – egmont Dec 23 '17 at 22:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.