Is there a difference in behaviours with respect to the flags passed to the script on the shebang line vs. using the set builtin?


#!/bin/bash -e

# do stuff

set -e
# do stuff

(The question is not specific to -e flag but in general for any such flags).

Obviously the set [flags] is effective only from the point it's set. But are there any other differences in functionality/behaviour?

POSIX shell中的行为也一样吗?