Skip to content

Commit d1cc089

Browse files
committed
Improve _is_sourced check
1 parent 6e85168 commit d1cc089

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docker-entrypoint.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ file_env() {
2727
# check to see if this file is being run or sourced from another script
2828
_is_sourced() {
2929
# https://unix.stackexchange.com/a/215279
30-
[ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ]
30+
[ "${#FUNCNAME[@]}" -ge 2 ] \
31+
&& [ "${FUNCNAME[0]}" = '_is_sourced' ] \
32+
&& [ "${FUNCNAME[1]}" = 'source' ]
3133
}
3234

3335
# used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user

0 commit comments

Comments
 (0)