I try to run a series of commands as a whole inside the main shell, but the way I was teached only works inside the subshell:
echo $BASHPID
18884
(echo "hello $BASHPID";sleep 5;echo "hello again $BASHPID")
hello 22268
hello again 22268
I also tried:
. (echo "hello $BASHPID";sleep 5;echo "hello again $BASHPID")
source (echo "hello $BASHPID";sleep 5;echo "hello again $BASHPID")
to use the source command, because I learned it forces the script to run inside the main shell.
I guess, it would work, if I put the commands inside a file and run it with the source command, but I would like to know if there is a way beyound a script file.