Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • 1
    Scripts don't run in subshells, so this output looks correct to me. What are you expecting? Commented Apr 23, 2019 at 21:27
  • @jim-chriss, Michael is right: executing a shell script runs that script is a separate process, not as a subshell of your interactive shell. Commented Apr 23, 2019 at 21:31
  • @Michael Homer shell scripts do run in subshells if invoked using their names in terminal, I quote the tldp book page 28, says "This is the most common way to execute a script. It is preferred to execute the script like this in a subshell." Commented Apr 24, 2019 at 8:25
  • No, they don't. Commented Apr 24, 2019 at 8:27
  • I will acknowledge that the book does say that, and that it does so because the book is incompetently written. Commented Apr 24, 2019 at 8:29