0

I'm trying to script some things and cannot figure out the correct syntax to append to root's .bashrc file. For this script, I'm just trying to get it to display the hostname in red when we ssh into it.

Normally, I append this below to /root/.bashrc and it works perfectly:

export PS1="\e[0;31m[\u@\h \W]\$ \e[m"

I've tried different variants of this below, but I can't figure out if the quotes are messing it up or what.

echo "export PS1="\e[0;31m[\u@\h \W]\$ \e[m"" >> ~/.bashrc

If I try the command above I'll get this error:

export PS1=e[0 bash: 31m[u@h: command not found...

Can you guys assist? TIA!

1 Answer 1

0

The answer is single quotes, like in

echo 'export PS1="\e[0;31m[\u@\h \W]\$ \e[m"' >> ~/.bashrc

0

You must log in to answer this question.

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