The code below prints Continuing
if I remove the subshell.
With the subshell, I need another succesful call after the test (using :
as a succesful no-op command is most straightforward, IMO) if I want to get to the Continuing
part.
#!/bin/sh
set -e #Exit on untested error
( #Subshell
#Some succesfful commands go here
#And here comes a file test
[ -f "doesntExist" ] && {
: #Irrelevant
}
#:
)
echo Continuing
Is this behavior correct? Why does introducing a subshell change the behavior of
[ -f "doesntExist" ] && {
:
}
I'm using the dash 0.5.7-2ubuntu2
to run this.