1

According to Bash tips: Colors and formatting (ANSI/VT100 Control sequences) I attemped to active blink code in my program, But may be blink code has been eliminated. Is it true?

If is not true, Please help me to use blink code.

  • 2
    By the way, some of the information in the bash wiki is incorrect (reading more sources will demonstrate this). – Thomas Dickey Mar 15 '16 at 0:37
7

The blink feature depends upon the terminal (or terminal emulator). Most terminals you will use accept the control sequences documented in ECMA-48, e.g., VT100-compatible. The control sequence may

  • cause blinking on a given terminal, or
  • show as a particular color, or
  • simply ignored by a given terminal

Applications usually use a terminal description (terminfo or termcap). If the terminal description does not tell how to blink, then the application will not know either.

If your computer has infocmp (for terminfo), that will show the capabilities listed in the terminal description. bash only looks for blink — using the termcap name, since it is a termcap application. More generally, terminfo can also describe how to blink using sgr (which is not available in termcap descriptions).

For example, this is a terminfo description of vt100:

> infocmp vt100
#       Reconstructed via infocmp from file: /usr/local/ncurses/share/terminfo/v/vt100
vt100|vt100-am|dec vt100 (w/advanced video),
        am, mc5i, msgr, xenl, xon,
        cols#80, it#8, lines#24, vt#3,
        acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>,
        clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr,
        cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J,
        cuf=\E[%p1%dC, cuf1=\E[C$<2>,
        cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA,
        cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>,
        enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, ka1=\EOq,
        ka3=\EOs, kb2=\EOr, kbs=^H, kc1=\EOp, kc3=\EOn, kcub1=\EOD,
        kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, kf0=\EOy,
        kf1=\EOP, kf10=\EOx, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOt,
        kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, lf1=pf1, lf2=pf2,
        lf3=pf3, lf4=pf4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8,
        rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l,
        rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>,
        rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7,
        sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>,
        sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=,
        smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g,

The corresponding termcap is

> infocmp -Cr vt100
#       Reconstructed via infocmp from file: /usr/local/ncurses/share/terminfo/v/vt100
vt100|vt100-am|dec vt100 (w/advanced video):\
        :5i:am:bs:ms:xn:xo:\
        :co#80:it#8:li#24:vt#3:\
        :@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:\
        :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\
        :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\
        :ae=^O:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\
        :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^J:\
        :eA=\E(B\E)0:ho=\E[H:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:\
        :k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:\
        :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\
        :ku=\EOA:l1=pf1:l2=pf2:l3=pf3:l4=pf4:le=^H:mb=\E[5m:\
        :md=\E[1m:me=\E[0m:mr=\E[7m:nd=\E[C:pf=\E[4i:po=\E[5i:\
        :ps=\E[0i:rc=\E8:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\
        :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>:\
        :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\
        :up=\E[A:us=\E[4m:

(The termcap name for blink is mb, which you can see in the description).

So... if you are not seeing blinking text, that could be (a) the terminal itself or (b) the terminal description.

Further reading:

  • I have mb, But I don't have blink with echo -e "\033[5mHello" – PersianGulf Mar 15 '16 at 0:50
  • But your terminal may not do blinking... (what terminal?) – Thomas Dickey Mar 15 '16 at 0:51
  • BTW, I removed m after 5, blink turn on and goto is turn on, oh .... – PersianGulf Mar 15 '16 at 0:52
  • But echo -e "\033[5Hello" would move your cursor to line 5. – Thomas Dickey Mar 15 '16 at 0:54
  • Oh, Would you write me true blink text? – PersianGulf Mar 15 '16 at 1:09
2

Sometimes the settings are buried deep in the settings in your terminal emulator.

In ITerm2:

  • Preferences (,)
  • Profiles
  • dark (-> my current profile)
  • Text
  • Text Rendering
  • ☑ Blinking text allowed
1

Blink code doesn't work on VTE terminal such as gnome-terminal, tilda, guake, terminator, xfce4-terminal and so on.

You have to try with xterm .

  • Yes - this has been known for some time (see this bug report for instance. – Thomas Dickey Mar 16 '16 at 20:08
  • 1
    Blinking will be supported in VTE 0.52 [to be released in March 2018] (gnome-terminal 3.28, and all other VTE-based emulators if using a recent enough VTE). – egmont Dec 23 '17 at 23:13
  • 1
    @egmont , Oh , It's new and very nice. – PersianGulf Mar 13 '18 at 5:30
1

printf '\033[5mHello\033[0m\n' produces:

Blinking text in

  • cool-retro-term 1.1.1
  • elementary-terminal 5.3.4
  • gnome-terminal 3.32.1
  • konsole5 18.12.3
  • mate-terminal 1.22.1
  • nemo-terminal 4.0.0
  • qterminal 0.14.0
  • rxvt-unicode 9.22
  • st 0.8.1
  • terminator 1.91
  • xfce4-terminal 0.8.7.4
  • xterm 344
  • yakuake 3.0.5
  • on macOS: Terminal, and also iTerm2 if activated in Profile > Text > Text Rendering.

Highlight through a background color in

  • FreeBSD 12 console
  • Eterm
  • on Windows: mintty (used by Cygwin), PuTTY

Highlight through a foreground color in

  • emacs-terminal 5.3.4
  • on Windows: TeraTerm

Reverse video in

  • mrxvt

No effect in

  • Linux console
  • Solaris 11.4 console
  • guake 0.8.8
  • lilyterm 0.9.9.2
  • lterm 1.5.1
  • lxterminal 0.3.2
  • roxterm 3.7.3
  • termit 2.9.6
  • on macOS: iTerm2 (unless explicitly activated)
  • Cygwin mintty blinks for me. Did you forget to enable the feature? – roaima Nov 15 at 7:28
0

I was looking for this from long time. I am using red hat Linux. After many expriments it is observed that echo -e "\e[5m Hello world \e[0m" will not blink on graphic mode I.e. Ctrl+alt+F7. It will work in command line mode from ctrl+alt+F1 to ctrl+alt+F6 only.

  • The "graphic mode" as you call it, usually (but not always) on Ctrl+Alt+F7, offers various terminal emulator applications. Some of these support blinking text, some don't. – egmont Jul 19 '18 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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