Top "Subshell" questions

A subshell refers to a shell invoked from within a parent shell.

Why is $$ returning the same id as the parent process?

I have problem with Bash, and I don't know why. Under shell, I enter: echo $$ ## print 2433 (echo $$) ## also print 2433 (./getpid) ## …

bash shell pid subshell
Set a parent shell's variable from a subshell

How do I set a variable in the parent shell, from a subshell? a=3 (a=4) echo $a

bash shell subshell
Is there a way to write a bash function which aborts the whole execution, no matter how it is called?

I was using "exit 1" statement in my bash functions to terminate the whole script and it worked fine: function func() { …

bash function exit subshell
Pipe multiple commands into a single command

How can I pipe the stdout of multiple commands to a single command? Example 1: combine and sort the output of …

bash shell process pipe subshell
Bash bad substitution with subshell and substring

A contrived example... given FOO="/foo/bar/baz" this works (in bash) BAR=$(basename $FOO) # result is BAR="baz" BAZ=${…

bash string substitution subshell
Jenkins pipeline sh does not seem to respect pipe in shell command

I am using a Jenkinsfile in a pipeline on version 2.32.2. For various reasons I want to extract the version string …

jenkins pipe jenkins-pipeline subshell
Difference between $() and () in Bash

When I type ls -l $(echo file) output from bracket (which is just simple echo'ing) is taken and passed to …

linux bash unix subshell
Left side of pipe is the subshell?

Edit: My comment below regarding sed 's@^@ @' <(f1) is incorrect While $BASH_SUBSHELL indicates that we are in …

bash variables unix pipe subshell
Get exit code from subshell through the pipes

How can I get exit code of wget from the subshell process? So, main problem is that $? is equal 0. Where …

bash pipe exit-code tee subshell
How do I activate a conda env in a subshell?

I've written a python program. And if I have a shebang like this one: #!/usr/bin/python and I make …

python bash conda shebang subshell