Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's horribly more complex than just that, the person you're replying to is "more correct" because of the rules of `set -e` which is critical in this thread; a singular command followed by && is treated differently than a compound command. Pull up `man bash` and search `/set.*abef` to read the rather long and involved paragraph for the `-e` option, running in a subshell is only part of it.


>I know $() invokes a subshell, but does () ?

>My guess was that the () affects the order of operations between ; and &&, so the first line is three commands, while the second line is two.

Emphasis mine. My understanding was that the question is simply about whether () invokes a subshell or not (irrespective of set -e)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: