I want to display the prompt (display name) in Bash terminal likeparentDirectory/currentDirectory $

Current settings

The prompt is currently set as follows in.bash_profile
export PS1 = "\ W \ $"
This makes the prompt look likecurrrentDirectory $(for example,/etc/ssh/displaysssh $).
I want to change this display likeparentDirectory/currentDirectory $.
If/etc/ssh/, likeetc/ssh
I don't know how to do this with regular expressions, so I'm going to ask you a question here.
Thank you.

  • MacOS Mojave v10.14.6
  • Terminal → iterm2 (Bash)