Results 1 to 5 of 5

Thread: Bash & CLI Set Up

  1. #1
    Join Date
    Nov 2019
    Beans
    3

    Question Bash & CLI Set Up

    Greetings all,
    I am trying to set up my Bash Terminal to show:
    I would like the cursor to blink and on the next line WITH the $.

    Code:
    user@computerName:~/dir/dir
    $ _

    But I have...

    Code:
    user@computerName:~/dir/dir$
    _
    I tinkered around and am not sure what next?

    Code:
    if [ "$color_prompt" = yes ]; then
        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    else
        PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
        PS1="$PS1\n"
    fi
    unset color_prompt force_color_prompt
    
    # If this is an xterm set the title to user@host:dir
    case "$TERM" in
    xterm*|rxvt*)
        PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\n: \w\a\]$PS1"
        PS1="$PS1\n"
        ;;
    *)
        ;;
    esac

  2. #2
    Join Date
    Dec 2014
    Beans
    2,721

    Re: Bash & CLI Set Up

    What else did you expect to happen if you append a newline character to the end of the prompt ? You need to put the '\n' where you want the new line to begin, like so:
    Code:
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\n\$ '
    You should also remove both the lines saying PS1="$PS1\n".

    Holger

  3. #3
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,853
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Bash & CLI Set Up

    You probably have a colour terminal, so the first line with PS1= is the one you want to modify. You could modify the next as well, just in case you use a black-and-white terminal one day. Just insert the \n where you need it. You can't have a newline in the title of the terminal, so I wouldn't modify that line with \e]0;. That line prepends an instruction to the prompt to set the title of the terminal window.

    As for blinking, you can make some text blink with the \033[5m escape sequence. This can be combined with the instructions for colours, for example
    Code:
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[05;95m\]\w\[\033[00m\]\$ '
    will make the curent working directory blink in bright magenta.

    This will only tell bash to instruct the terminal to set those colours and blink the text. You may have to change your terminal settings to accept those instruction from bash; blinking may be disabled by default.

    I haven't found anything in wiki's ANSI escape code about setting the blinking cursor. I think that's something you have to configure in the terminal settings. Don't expect the cursor and the text to blink in phase.

  4. #4
    Join Date
    Mar 2010
    Location
    USA
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Bash & CLI Set Up

    You didn't say it what you meant by "BASH Terminal" was a Console or Graphical Terminal Emulation (and if, which one)...

    That would affect how you change the cursor shape, blinking (or not), and blink rate...

    "Concurrent coexistence of Windows, Linux and UNIX..." || Ubuntu user # 33563, Linux user # 533637
    Sticky: Graphics Resolution | UbuntuForums 'system-info' Script | Posting Guidelines | Code Tags

  5. #5
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Bash & CLI Set Up

    I have yakuake installed with blinking cursor.

    Add ..
    BlinkingCursorEnabled=true
    to the [Terminal Features] section of the .profile file in ~.local/share/konsole.

Tags for this Thread

Bookmarks

Posting Permissions

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