I would like to remove my mac's username from the terminal and ideally just have the directory and $ on the line.
I've tried going into preferences and setting the shell to run command:
PS1 = "\ w \ $"; clear;
This doesn't work.
When assigning a variable, there can't be whitespace around the =
sign.
Try removing it: PS1="\ w \ $"
Also, if you're using zsh
on your Mac, the \w
doesn't seem to work. Try using $(pwd)
for the current working directory instead.
Try anyone from the below options,
Option 1:
export PS1="\W \$"; clear;
export PS1="\W \$"; clear;
OR
Option 2: This will show directory and $ as a prompt
echo "export PS1='\W \$'" >> ~/.bash_profile
. ~/.bash_profile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.