Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8971271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:54:51+00:00 2026-06-15T17:54:51+00:00

When cycling through statements entered to the console, I occasionally find that the text

  • 0

When cycling through statements entered to the console, I occasionally find that the text I entered isn’t refreshed and the prompt is moved to the right.

My original, intended prompt: http://cl.ly/image/04080N260L1V.

What happens after hitting the Up and Down arrows about a dozen times: http://cl.ly/image/1n3S2K31340R.

In case the screenshots aren’t clear, the underlined text (in this case, “vim ~/.bas“) is getting “added” to the prompt. I can’t delete it out. However, if I delete as much as I can, clearing any text after the prompt, and hit Enter, I’m greeted with my clean, original prompt again: http://cl.ly/image/2O1h1Z2y0n2I.

Here’s what ~/.bash_profile contains:

# Simpler bash prompt in Terminal.app
promptColor="\e[1;34m"
endColor="\e[m"
#export PS1='\e[0;36m\w$ \e[0m'
export PS1="$promptColor\w$ $endColor"

# Syntax highlighting for commands like `ls` and such
alias ls="ls -G"

# PATH ammendment to put Homebrew-installed apps in front of system-provided ones
homebrew=/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin
export PATH=$homebrew:$PATH

I’ve narrowed the culprit down to the PS1 variable. (You can see I’ve tried this a few different ways.) Based on what I’ve read, I’m using the color codes correctly.

Any help would be fantastic. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:54:52+00:00Added an answer on June 15, 2026 at 5:54 pm

    This is a FAQ. In order for Bash to be able to compute the display length of the prompt correctly, any non-printing sequences such as color codes need to be inside a \[...\] sequence.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When one of my sprites is being dragged (moved around), I'm cycling through other
I am learning JQuery and trying to create cycling text through images but I
I'm creating thumbnails cycling through a lot of images, when I find a large
Problem - instead of cycling through the images in the array, it jumps right
I have written some code which produces simple animations based on cycling through a
I am cycling through the contents of a two-dimensional array containing the result of
I need to get a list of steps which jquery will be cycling through
I'm cycling through several different attributes looking for something not set to To do
I'm cycling through an array and adding up a figure. I have a value
I want to invoke methods with a certain attribute. So I'm cycling through all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.