-2

I wanted to customize my terminal and one of the things I did was install zsh and made zsh my default shell (on iterm2). Now I wanted to customize my ps1. Following online tutorials, I edited my ~/.bash_profile and added the line PS1 = "\h:\W" Then I ran the command source ~/.bash_profile and now my terminal prompt starts with just "\h:\W". When in reality, I expected it to return "MyName: Current Directory" I have no idea how to fix this. Editing my PS1 does not help the situation. Not sure why the backslashes haven't been working like in the PS1 guidelines I've found online.

Cyrus
  • 84,225
  • 14
  • 89
  • 153
hferaidon
  • 29
  • 4
  • 2
    Have you considered configuring your zsh instead of bash? – Mad Physicist Jun 16 '19 at 04:05
  • 1
    `zsh` is not some sort of add-on on top of `bash`; it's a different shell. If you are using `zsh`, then `.bash_profile` is no longer relevant. You need to modify zsh configuration files. – chepner Jun 18 '19 at 03:19
  • Adding to the comment by @chepner: It doesn't make sense to source your .bash_profile, if you don't use bash. Maybe you want to use both zsh and bash, and want to have one file with common settings for both - I do it that way. In this case, write those configurations you want to have identical in both shells, into a separate file (for instance environment variables) - PS1 for sure is not one of them -, and source this from both .bash_profile and .zshrc. Be careful that you write this _common file_ in a way that it is compatible to both shells. – user1934428 Jun 20 '19 at 13:30

1 Answers1

1

From Customizing your shell prompt - For your user id and the current folder (and zsh)

PS1="%n:%/ "

on my mac that yields the prompt

efrisch:/Users/efrisch

I have no idea how to fix this You can also remove the line you added to your ~/.bash_profile and logout and back-in.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249