terminal output \W $

I was trying to change the hostname and due to some error in the command, my terminal got messed up.

enter image description here

  • 3
    How did you try to change the hostname? Does the problem persist if you open a new tab in Terminal? – nohillside Jan 31 at 19:14
  • Yes, the problem persists. This is the command I used. ` export PS1="\W \$"` – Learning In Progress Jan 31 at 19:35
  • PS1="\W \$" works here, are you sure that this is exactly how you entered it in your .bashrc? Can you please edit your question and copy/paste the relevant line directly? – nohillside Jan 31 at 19:37
  • 1
    That‘s not where you defined the prompt. Please show us where you‘ve defined it, in which file. – nohillside Jan 31 at 20:35
  • I was able to replicate the problem by escaping the \W. The command I used was export PS1="\\\W \$". Just try setting it again to what you expected it to be. – Allan Feb 1 at 15:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.