I have a situation where I need to provide a subshell to a user mid-way through a longish process. I would like to change the prompt to remind the user that they are in a special subshell and haven't gone through the rest of the process yet. I thought that this would do what I want...echo PS1='foo:' | bash -iBut when I enter that line, this is the output I getme@mercury:~$ PS1='foo:'foo:exitme@mercury:~$ Is there a simple way around this? I could writeup my own custom bashrc... but I'd prefer to preserve the user's usual bash-shell setup.
Changing the PS1 on an interactive bash subshell easily
bash
You can use process substitution to essentially make a ~/.bashrc that only exists for the bash -i invocation like so: bash --rcfile <(echo PS1='foo: ') -i