Fix arguments for sourced script

Shifts around the arguments and updates $0 so that they would be as you
expect if the script was exec'd instead of source'd
This commit is contained in:
Bao Trinh 2023-12-07 17:27:31 -06:00
parent 2de0c2304a
commit bcc17b9d1a
No known key found for this signature in database
GPG key ID: 66B50C2AD65984B2

View file

@ -22,5 +22,7 @@ __BASHIO_LIB_DIR=$(dirname "${__BASHIO_BIN}")
source "${__BASHIO_LIB_DIR}/bashio.sh"
# Execute source
BASH_ARGV0=${1:?script to source must be provided}
shift
# shellcheck source=/dev/null
source "$@"
source "$0" "$@"