Run an interactive bash subshell with initial commands without returning to the (“super”) shell immediately

This can be easily done with temporary named pipes:

bash --init-file <(echo "ls; pwd")

Credit for this answer goes to the comment from Lie Ryan. I found this really useful, and it’s less noticeable in the comments, so I thought it should be its own answer.

Leave a Comment