1

I'm just trying to change the terminal prompt in macOS Sierra. Nothing fancy, I just need to know the current path.

In my ~/.bash_profile I'm adding

export PS1="[\w] > "

I know that \w should be replaced by current full path but none of the escape characters seems to work on my Mac. I just get the same string without evaluating, so my prompt looks like

[\w] >

I've tried many different PS1 strings without luck. I also tried using .bashrc instead bash_profile.

Any ideas?

rmvz3
  • 1,133
  • 2
  • 16
  • 27

2 Answers2

3

I suspect you're running a shell that doesn't understand the \w escape in the prompt string. If echo $0 returns something other than -bash, you have to use whatever that shell understands:

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
0

Run the following command to change your shell to bash (you will be prompted to enter your password). Restart the "Terminal" after that.

chsh -s /bin/bash
Unmesh
  • 587
  • 4
  • 4