Skip to main content
added 127 characters in body
Source Link
john smith
  • 895
  • 6
  • 17
  • 32

I'm reading the bash manual and came to a section that states:

"Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment"

My question is, is there a way I could actually see what was executed in the subshell. For example say I wrote the line below. What would I need to do to actually see what was executed in the subshell?

$ printf "first\nsecond\nthird" | grep -E "(first|second)"

How would I check what was actually executed in the subshell (i suspect it does a grep for "first" and then a second shell to grep for "second", but I'd just like to see what it's doing).

I'm reading the bash manual and came to a section that states:

"Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment"

My question is, is there a way I could actually see what was executed in the subshell. For example say I wrote the line below. What would I need to do to actually see what was executed in the subshell?

$ printf "first\nsecond\nthird" | grep -E "(first|second)"

How would I check what was actually executed in the subshell

I'm reading the bash manual and came to a section that states:

"Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment"

My question is, is there a way I could actually see what was executed in the subshell. For example say I wrote the line below. What would I need to do to actually see what was executed in the subshell?

$ printf "first\nsecond\nthird" | grep -E "(first|second)"

How would I check what was actually executed in the subshell (i suspect it does a grep for "first" and then a second shell to grep for "second", but I'd just like to see what it's doing).

Source Link
john smith
  • 895
  • 6
  • 17
  • 32

Subshell Command Execution

I'm reading the bash manual and came to a section that states:

"Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment"

My question is, is there a way I could actually see what was executed in the subshell. For example say I wrote the line below. What would I need to do to actually see what was executed in the subshell?

$ printf "first\nsecond\nthird" | grep -E "(first|second)"

How would I check what was actually executed in the subshell