Please note: Although this question is essentially the same as this linked question, I did not mark it as "solving my problem" because the answers provided there are not very satisfactory. The answer I accepted below is cleaner and simpler. Take a look!
I know how to pass
bash a custom command to execute, e.g. like this:
bash -c "/bin/echo hello"
When I do this,
bash executes the argument of
-c and then exits. How can I get it to give me an interactive prompt when I'm done? Adding
-i has no effect. I don't want to write the custom commands into a file that
.bashrc always reads.
I've been making do with
bash -c "commands; exec bash -i", but it's not ideal since it starts
bash twice. Is there a way to get the same effect while starting
bash only once?