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.
echo "hello $BASHPID";sleep 5;echo "hello again $BASHPID"
? – Rui F Ribeiro May 22 '17 at 15:21()
anyhow) – Philippos May 22 '17 at 15:28source
with:source <(echo 'echo "hello $BASHPID";sleep .5;echo "hello again $BASHPID"')
– F. Hauri - Give Up GitHub May 22 '17 at 15:46