Previous commands wrapped with square brackets in OS X Terminal

Yesterday my terminal started surrounding commands that had been run with square brackets. I'm not sure how I've turned this on, but would like to turn it off.

Example: Square brackets around commands

So far, I've done:

  • Checked that there's nothing funny in my .bash_profile
  • Tried changing the profile back to Basic
  • Tried changing to a different shell (zsh)

I've not been able to uncover anything on Google either.

Any ideas?


Update

Output of echo "$PS1"; echo "$PROMPT_COMMAND" enter image description here


Solution 1:

Got it! Somehow I'd accidentally turned "Automatically Mark Prompt Lines" on:

enter image description here

I do wonder though where that configuration is stored on disk, as I also tried:

  • Deleting ~/Library/Preferences/com.apple.Terminal.plist
  • Running Terminal from my Yosemite partition (didn't show the marks)
  • Extracting a fresh copy of Terminal from the El Capitan installer (did show the marks)

Solution 2:

View > Hide Marks hides these square-bracket lines, without removing the ability to navigate with them, giving the best of both worlds.