ajwood
ajwood

Reputation: 19027

Escaping characters in PS1

I'm starting a new session of bash using a command like this:
exec bash --init-file <(cat /etc/profile ~/.bashrc $ANOTHER_SCRIPT) -i
I'd like to also change the prompt of new session without having to add another init file... I suspect my best bet is something like this:
exec bash --init-file <(cat /etc/profile ~/.bashrc $ANOTHER_SCRIPT; echo "PS1='[TEST] '$PS1") -i
I think my problems concern escaped characters... but I'm quite clueless about how to continue tackling the problem as prepending my label to the prompt.

Any thoughts are greatly appreciated,

Andrew

Upvotes: 3

Views: 2043

Answers (2)

Dennis Williamson
Dennis Williamson

Reputation: 359955

This should work:

exec bash --init-file <(cat /etc/profile ~/.bashrc $ANOTHER_SCRIPT; echo 'PS1="[TEST] $PS1"') -i

Upvotes: 3

SiegeX
SiegeX

Reputation: 140257

PS1="[TEST] $PS1"

You can't put this on the same line as your <(cat ...) process substitution since it's expecting only files but rather inside your ~/.bashrc file

Upvotes: 1

Related Questions