8000 Improve _is_sourced check · dfsdevops/postgres@d1cc089 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Lines changed: 3 additions & 1 deletion
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)
0