Do parentheses really put the command in a subshell?
173
votes
3
answers
193113
views
From what I've read, putting a command in parentheses should run it in a subshell, similar to running a script. If this is true, how does it see the variable x if x isn't exported?
x=1
Running
(echo $x)
on the command line results in 1
.
Running echo $x
**in a script** results in nothing, as expected.
Asked by Igorio
(7917 rep)
Jun 21, 2014, 05:50 PM
Last activity: May 24, 2025, 08:04 AM
Last activity: May 24, 2025, 08:04 AM