Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start bash process with changed prompt PS1

Tags:

bash

shell

How do I start a bash subprocess with a changed prompt. Using env does not work:

env PS1="change >" bash --login

does not work. The result should be the same as using export after the process is started:

$ export PS1="change >"
change >

~/.bashrc has to be evaluated as usual.

like image 494
Thomas Jung Avatar asked Dec 31 '11 11:12

Thomas Jung


1 Answers

Another solution would be:

bash --rcfile <(cat ~/.bashrc; echo 'PS1="change > "')

This keeps the aliases and co by executing and "extended" version of the users startupfile.

like image 180
A.H. Avatar answered Oct 26 '22 10:10

A.H.