From 97e1333197af6d92ee25c2e0cb5d30668ee61d6c Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Thu, 13 Feb 2025 11:51:24 -0500 Subject: [PATCH] Shellcheck fixes, mostly quoting to avoid word splitting --- bin/pyenv-virtualenvs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/pyenv-virtualenvs b/bin/pyenv-virtualenvs index eae9b67..a43ece2 100755 --- a/bin/pyenv-virtualenvs +++ b/bin/pyenv-virtualenvs @@ -7,7 +7,7 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x -if [ -L "${BASH_SOURCE}" ]; then +if [ -L "${BASH_SOURCE[0]}" ]; then READLINK=$(type -p greadlink readlink | head -1) if [ -z "$READLINK" ]; then echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 @@ -16,12 +16,12 @@ if [ -L "${BASH_SOURCE}" ]; then resolve_link() { $READLINK -f "$1" } - script_path=$(resolve_link ${BASH_SOURCE}) + script_path=$(resolve_link "${BASH_SOURCE[0]}") else - script_path=${BASH_SOURCE} + script_path="${BASH_SOURCE[0]}" fi -. ${script_path%/*}/../libexec/pyenv-virtualenv-realpath +. "${script_path%/*}"/../libexec/pyenv-virtualenv-realpath if [ -z "$PYENV_ROOT" ]; then PYENV_ROOT="${HOME}/.pyenv" @@ -187,3 +187,4 @@ if [ "$num_versions" -eq 0 ] && [ -n "$include_system" ]; then echo "Warning: no Python virtualenv detected on the system" >&2 exit 1 fi +