Questions tagged [subshell]

Use where a shell is run inside a shell (nested shells)

A sub-shell is a shell run inside another shell, typically the same shell. Sub-shell invocation typically uses some special syntax.

234 questions
2
votes
1 answer

Subshells not working

I want to run several commands in parallel, but I have no idea why the following code piece does not work. #!/bin/bash ( ping 8.8.8.8 ) ( ping 192.168.0.1 ) It completely ignores the second ping command. Why is that so? Edit: OK, now I know that…
mkdrive2
  • 662
0
votes
1 answer

How can I detect if I am in subshell, in bash and ZSH?

This question is different from In Bash, how can I detect if I'm in a subshell? because it's not shell specific. Let's say I open a terminal, which is zsh. I can go deep into that like this, $ echo $$ 359648 $ zsh $ echo $$ 359706 $ zsh $ echo…
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315