문제

I'm customizing my bash prompt (I use iTerm on OS X Lion), and have tried something like:

PS1='\n[\u]-> '

Just for simplicity, but after reloading my ~/.bash_profile, my prompt now says:

\n[\u]->

and not what I'm expecting to (a new line, followed by my username).

Any ideas?

도움이 되었습니까?

해결책

How is the shell being invoked? If it's as sh, or possibly other ways, it won't be interpreted. Try echo $0

다른 팁

Notice the single quotes in your prompt? Bash syntax treats single and double quotes differently. Use double quotes to allow the shell to expand the special chars.

Also, do you have promptvars set?

Try replacing the single quotes with double quotes, i.e. PS1="\n[\u]-> ".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top