0

While executing a script in bash

echo "export PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '" >> /home/testusername/.bash_profile

While I am reading the file is missing one character which is a "\" right after "W]"

Result of reading:

export PS1='\[\e[1;32m\][\u@\h \W]$\[\e[0m\] '

Manually pasted the same line of code in .bash_profile

export PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '

There is a difference of one character, what could be the problem?

1 Answer 1

0

the problem is ' and ". if you change the sequence of them your problem will solve.

echo 'export PS1="\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] "'

I refer you to this answer for more explanation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .