Sample Header Ad - 728x90

Execute bash inside subshells

1 vote
1 answer
1968 views
Say I have a command that puts me into a subshell (e.g. nix-shell). If I have a bash script that goes
enter-subshell
echo hi
the echo hi will wait to be executed until I exit the subshell. Is there any way to write a script that behaves the same as manually typing out both lines in order? In other words, subsequent commands get executed in the newly invoked shell? Edit: it seems what I'm looking to do doesn't have a general solution.
Asked by Mason (519 rep)
Mar 10, 2021, 02:36 AM
Last activity: Mar 26, 2025, 03:04 AM