How to invoke bash, run commands inside the new shell, and then give control back to user? June 22, 2022 by Tarik Billa bash --rcfile <(echo '. ~/.bashrc; some_command') dispenses the creation of temporary files. Question on other sites: https://serverfault.com/questions/368054/run-an-interactive-bash-subshell-with-initial-commands-without-returning-to-the https://unix.stackexchange.com/questions/123103/how-to-keep-bash-running-after-command-execution More Related Contents: What’s the difference between .bashrc, .bash_profile, and .environment? sh: 1: Syntax error: "(" unexpected error Input data to a shell script [closed] How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)? When do we need curly braces around shell variables? Replace one substring for another string in shell script What are the uses of the exec command in shell scripts? [closed] How can I reverse the order of lines in a file? How to assign the output of a Bash command to a variable? [duplicate] Running script upon login in mac OS X [closed] How to append output to the end of a text file Command substitution: backticks or dollar sign / paren enclosed? [duplicate] Escape dollar sign in string by shell script What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”? Read JSON data in a shell script [duplicate] Reading a space-delimited string into an array in Bash Piping tail output though grep twice using alias in shell script? [duplicate] bash set -e and i=0;let i++ do not agree Shell script – remove first and last quote (“) from a variable How to use sed to remove the last n lines of a file How to check if a process is running inside docker container? How do I run multiple background commands in bash in a single line? Why equal to operator does not work if it is not surrounded by space? In bash, is there an equivalent of die “error msg” How do I prevent root access to my docker container Multithreading in Bash [duplicate] Difference between shell and environment variables How do I integrate MSYS2 shell into Visual studio code on Window? Write a bash shell script that consumes a constant amount of RAM for a user defined time [closed]