Results 1 to 9 of 9

Thread: BASH - Command echo - Cannot echo in bold

  1. #1
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,069

    Default BASH - Command echo - Cannot echo in bold

    Hello.

    Code:
    USER="TOTO"
    green='\e[0;32m'
    endColor='\e[0m'
    undesc='\e[04m'
    bold='\e[01m'
    # or '\E[01m' or '\E[1m' or '\x1b[1m'
    # Display welcome message echo -e "Welcome ${green}$USER${endColor} user\n" #Welcome TOTO user # OK in green echo -e "Welcome ${bold}$USER${endColor} user\n" #Welcome TOTO user # KO in normal character only echo -e "Welcome ${undesc}$USER${endColor} user\n" #Welcome TOTO user # OK underlined character
    I am unable to echo in bold!

    Any help is welcome

    ------------------------------------------------------------------------------------------------------

    NAME=openSUSE
    VERSION="Tumbleweed"
    VERSION_ID="20160121"
    PRETTY_NAME="openSUSE Tumbleweed (20160121) (x86_64)"
    ID=opensuse
    ANSI_COLOR="0;32"
    CPE_NAME="cpe:/opensusepensuse:20160121"
    BUG_REPORT_URL="https://bugs.opensuse.org"
    HOME_URL="https://www.opensuse.org/"
    ID_LIKE="suse"
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,000
    Blog Entries
    14

    Default Re: BASH - Command echo - Cannot echo in bold

    Have a look at
    Code:
    man tput
    The tput command allows you to position the cursor and amongst other things, to have bold text.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: BASH - Command echo - Cannot echo in bold

    Quote Originally Posted by jcdole View Post
    I am unable to echo in bold!
    And what terminal emulator are you using? (or is this in text mode?)

    Your commands work as expected here in 13.2, and I tried with Konsole 4.14.3 (the KDE4 version), Konsole 15.12.1 (the latest KF5 version), and xterm.

    It might be a problem with the used font though, so try to change that as a test (in Konsole: "Edit current profile", or KDE's "Configure Desktop"/systemsettings5).

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,287

    Default Re: BASH - Command echo - Cannot echo in bold

    You apparently use ANSI/VT100 terminal Escape sequences. The terminal you send these sequences to must support this. As you do not tell what you use as terminal (emulator), it is a bit difficult te be specific.

    Most terminal emulators, like Konsole and xterm do suport this though.
    Last edited by hcvv; 25-Jan-2016 at 12:50. Reason: ASCII > ANSI
    Henk van Velden

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,801
    Blog Entries
    3

    Default Re: BASH - Command echo - Cannot echo in bold

    Quote Originally Posted by jcdole View Post
    I am unable to echo in bold!
    Your script worked as expected, using either "xterm" or "konsole".

    If I use CTRL-ALT-F1, and try it there on the virtual console, the "bold" comes out blue instead of bold.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  6. #6
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,069

    Default Re: BASH - Command echo - Cannot echo in bold

    Quote Originally Posted by hcvv View Post
    As you do not tell what you use as terminal
    Quote Originally Posted by wolfi323 View Post
    And what terminal emulator are you using?
    I am using standard KDE Konsole with initial setup.

    I had used tput but does not work.
    I shall try tput one more time and give you news.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  7. #7

    Default Re: BASH - Command echo - Cannot echo in bold

    Quote Originally Posted by jcdole View Post
    I am using standard KDE Konsole with initial setup.
    Ok, I was able to reproduce your problem by switching the font to Oxygen Mono, Plasma5's default monospace font.

    So as I suggested already, this is a font problem.
    Configure a different one (either via "Edit current profile" in Konsole, or the general fonts settings in "Configure Desktop") and it should work.
    Or maybe playing with the hinting style/anti-aliasing settings might help too.

  8. #8
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,069

    Default Re: BASH - Command echo - Cannot echo in bold

    Same problem on 13.2

    Seems not to depend of the font chosen.

    Typing this sequence in a new Konsole
    Code:
    USER="TOTO"
    green='\e[0;32m'
    endColor='\e[0m'
    undesc='\e[04m'
    bold='\e[01m'
    # or '\E[01m' or '\E[1m' or '\x1b[1m'
    # Display welcome message echo -e "Welcome ${green}$USER${endColor} user\n" #Welcome TOTO user # OK in green echo -e "Welcome ${bold}$USER${endColor} user\n" #Welcome TOTO user # OK in normal character only echo -e "Welcome ${undesc}$USER${endColor} user\n" #Welcome TOTO user # KO underlined character

    I can set the underlined characters by forcing a redraw event just by opening another apps or by changing the focus.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  9. #9
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,405
    Blog Entries
    2

    Default Re: BASH - Command echo - Cannot echo in bold

    Hmmmm...

    On a LEAP KDE using Konsole,
    I can only see the GREEN and the Underlined but
    not the BOLD.

    Have tried about 4 other various fonts besides Oxygen Mono(No obvious system fonts) without any difference supporting BOLD.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •