If the path includes spaces, you're going to need to quote it.
Your line export PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH
causes Bash to interpret the PATH=/Users/ps1/Documents/PS
part as the full first argument to your PATH—telling export
to set the PATH to only the section before the space. If you use export "PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH"
, it will interpret the entire PATH=/Users/ps1/Documents/PS 1/whatever-else/:$PATH
as part of the first argument. By convention, most people only quote the right side of the equals sign, because it looks nicer, it's the only thing that needs quoted, and bash automatically concatenates strings with no spaces between them.
See this answer on the Unix & Linux SE. There are a number of additional colors that can be used in a 256 color terminal.
You can view the colors in Terminal, and see their codes, by running this bash script. (There is a also a color chart in the above linked post, or IMO a more readable chart here.)
#!/bin/bash
color=16;
while [ $color -lt 245 ]; do
echo -e "$color: \\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m"
((color++));
done
Once you determine the colors you want, and have the color codes, you can use them in a PS1 prompt like shown below.
48;5;#
where # is the color number you want, sets the background color.
38;5;#
again # replaced with the color number, sets the foreground color.
In my case I wanted the default background that Terminal set when it was launched, and I use 0
to note this. (You can also see that toward the end of the sequence \[\e[0m\]
- same idea, using 0 to reset everything to the default.)
export PS1='\[\e[0;38;5;166m\]\u@\H\[\e[0m\] \w $ '
The below screenshot shows my original, default prompt, and then how it looks when I sourced .bash_profile
after defining PS1
:
Best Answer
Simply enter
then go to the line
and delete that line. Then save the file and exit nano. After then execute
That will be load the settings from this file.