LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   zsh PS1, dollar sign in the beginning, why? (https://www.linuxquestions.org/questions/linux-newbie-8/zsh-ps1-dollar-sign-in-the-beginning-why-858543/)

Mr. Alex 01-25-2011 08:55 AM

zsh PS1, dollar sign in the beginning, why?
 
Here's the prompt for zsh:
Code:

PS1=$'%B%n @ %M%b %{\e[1;32m%}%~%{\e[0m%} $ '
Found somewhere that "$" before quotes. What does it do? Do I really need this "$" after "="?

David the H. 01-25-2011 09:48 AM

$'string' is a quoting pattern that will evaluate any baskslash-escaped characters it encloses into their literal equivalents. It's similar in function to echo -e (at least in bash, not sure about zsh), except that it can also be used in places other than just echoing text.

$'\t' evaluates to a literal tab character, for example.

I've located the zsh user guide section concerning it:
http://zsh.sourceforge.net/Guide/zshguide05.html#l115


All times are GMT -5. The time now is 01:25 PM.