12 lines
392 B
Plaintext
12 lines
392 B
Plaintext
|
#!/bin/bash
|
||
|
env_file () {
|
||
|
env=${1:-.env}
|
||
|
[[ -f "${env}" ]] && { echo $env; return 0; } # || echo not $env
|
||
|
[[ -f "${env}.env" ]] && { echo "${env}.env"; return 0; } # || echo not ${env}.env
|
||
|
[[ -f "${env}/.env" ]] && { echo "${env}/.env"; return 0; } # || echo not ${env}/.env
|
||
|
return 1
|
||
|
}
|
||
|
|
||
|
# # if script was executed then call the function
|
||
|
(return 0 2>/dev/null) || env_file $@
|