Skip to content

Commit

Permalink
Merge pull request #57 from fox-forks/hyperupcall-shellcheck
Browse files Browse the repository at this point in the history
Fix various ShellCheck violations
  • Loading branch information
kvendingoldo authored Feb 16, 2024
2 parents cf07230 + 5f89a32 commit 12ea420
Show file tree
Hide file tree
Showing 25 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion lib/tofuenv-bashlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function log() {

shift 1;

local line="$@";
local line="$*";

# RFC 5424
#
Expand Down
4 changes: 2 additions & 2 deletions lib/tofuenv-exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -uo pipefail;

function tofuenv-exec() {
for _arg in ${@:1}; do
for _arg in "${@:1}"; do
if [[ "${_arg}" == -chdir=* ]]; then
log 'debug' "Found -chdir arg. Setting TOFUENV_DIR to: ${_arg#-chdir=}";
export TOFUENV_DIR="${PWD}/${_arg#-chdir=}";
Expand Down Expand Up @@ -38,7 +38,7 @@ function tofuenv-exec() {
TF_BIN_PATH="${TOFUENV_CONFIG_DIR}/versions/${TOFUENV_VERSION}/tofu";
export PATH="${TF_BIN_PATH}:${PATH}";
log 'debug' "TF_BIN_PATH added to PATH: ${TF_BIN_PATH}";
log 'debug' "Executing: ${TF_BIN_PATH} $@";
log 'debug' "Executing: ${TF_BIN_PATH} $*";

exec "${TF_BIN_PATH}" "$@" \
|| log 'error' "Failed to execute: ${TF_BIN_PATH} $*";
Expand Down
26 changes: 13 additions & 13 deletions lib/tofuenv-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ function curlw () {
TLS_OPT="";
fi;

if [[ ! -z "${TOFUENV_NETRC_PATH:-""}" ]]; then
if [[ -n "${TOFUENV_NETRC_PATH:-""}" ]]; then
NETRC_OPT="--netrc-file ${TOFUENV_NETRC_PATH}";
else
NETRC_OPT="";
fi;

if [[ ! -z "${TOFUENV_GITHUB_TOKEN:-""}" ]]; then
if [[ -n "${TOFUENV_GITHUB_TOKEN:-""}" ]]; then
AUTHORIZATION_HEADER="Authorization: Bearer ${TOFUENV_GITHUB_TOKEN}";
else
AUTHORIZATION_HEADER="";
Expand All @@ -94,7 +94,7 @@ function check_active_version() {
maybe_chdir="-chdir=${2}";
fi;

local active_version="$(${TOFUENV_ROOT}/bin/tofu ${maybe_chdir} version | grep '^OpenTofu')";
local active_version="$("${TOFUENV_ROOT}/bin/tofu" ${maybe_chdir} version | grep '^OpenTofu')";

if ! grep -E "^OpenTofu v${v}((-dev)|( \([a-f0-9]+\)))?( is already installed)?\$" <(echo "${active_version}"); then
log 'debug' "Expected version ${v} but found ${active_version}";
Expand All @@ -109,7 +109,7 @@ export -f check_active_version;
function check_installed_version() {
local v="${1}";
local bin="${TOFUENV_CONFIG_DIR}/versions/${v}/tofu";
[ -n "$(${bin} version | grep -E "^OpenTofu v${v}((-dev)|( \([a-f0-9]+\)))?$")" ];
"${bin}" version | grep -qE "^OpenTofu v${v}((-dev)|( \([a-f0-9]+\)))?$"
};
export -f check_installed_version;

Expand All @@ -122,18 +122,18 @@ export -f check_default_version;

function cleanup() {
log 'info' 'Performing cleanup';
local pwd="$(pwd)";
log 'debug' "Deleting ${pwd}/version";

log 'debug' "Deleting ${PWD}/version";
rm -rf ./version;
log 'debug' "Deleting ${pwd}/versions";
log 'debug' "Deleting ${PWD}/versions";
rm -rf ./versions;
log 'debug' "Deleting ${pwd}/.opentofu-version";
log 'debug' "Deleting ${PWD}/.opentofu-version";
rm -rf ./.opentofu-version;
log 'debug' "Deleting ${pwd}/latest_allowed.tf";
log 'debug' "Deleting ${PWD}/latest_allowed.tf";
rm -rf ./latest_allowed.tf;
log 'debug' "Deleting ${pwd}/min_required.tf";
log 'debug' "Deleting ${PWD}/min_required.tf";
rm -rf ./min_required.tf;
log 'debug' "Deleting ${pwd}/chdir-dir";
log 'debug' "Deleting ${PWD}/chdir-dir";
rm -rf ./chdir-dir;
};
export -f cleanup;
Expand All @@ -145,8 +145,8 @@ function error_and_proceed() {
export -f error_and_proceed;

function check_dependencies() {
if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
if ! [ $(which ggrep) ]; then
if [[ $(uname) == 'Darwin' ]] && [ "$(which brew)" ]; then
if ! [ "$(which ggrep)" ]; then
log 'error' 'A metaphysical dichotomy has caused this unit to overload and shut down. GNU Grep is a requirement and your Mac does not have it. Consider "brew install grep"';
fi;

Expand Down
4 changes: 2 additions & 2 deletions lib/tofuenv-min-required.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ set -uo pipefail;
function tofuenv-min-required() {
local path="${1:-${TOFUENV_DIR:-.}}";

local versions="$( echo $(cat ${path}/{*.tf,*.tf.json} 2>/dev/null | grep -Eh '^\s*[^#]*\s*required_version') | grep -o '[~=!<>]\{0,2\}\s*\([0-9]\+\.\?\)\{2,3\}\(-[a-z]\+[0-9]\+\)\?')";
local versions="$( echo $(cat "${path}"/{*.tf,*.tf.json} 2>/dev/null | grep -Eh '^\s*[^#]*\s*required_version') | grep -o '[~=!<>]\{0,2\}\s*\([0-9]\+\.\?\)\{2,3\}\(-[a-z]\+[0-9]\+\)\?')";

if [[ "${versions}" =~ ([~=!<>]{0,2}[[:blank:]]*)([0-9]+[0-9.]+)[^0-9]*(-[a-z]+[0-9]+)? ]]; then
qualifier="${BASH_REMATCH[1]}";
found_min_required="${BASH_REMATCH[2]}${BASH_REMATCH[3]}";
if [[ "${qualifier}" =~ ^!= ]]; then
log 'debug' "required_version is a negation - we cannot guess the desired one, skipping.";
else
local min_required_file="$(grep -Hn required_version ${path}/{*.tf,*.tf.json} 2>/dev/null | xargs)";
local min_required_file="$(grep -Hn required_version "${path}"/{*.tf,*.tf.json} 2>/dev/null | xargs)";

# Probably not an advisable way to choose a tofu version,
# but this is the way this functionality works in tofu:
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv---version
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-exec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
4 changes: 2 additions & 2 deletions libexec/tofuenv-help
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -uo pipefail;

echo 'Usage: tofuenv [<global options>] <command> [<options>]
echo "Usage: tofuenv [<global options>] <command> [<options>]
Commands:
install Install a specific version of OpenTofu
Expand All @@ -18,6 +18,6 @@ Commands:
Global options:
--version Print current version of tofuenv
--help Show this help output
';
";

exit 0;
2 changes: 1 addition & 1 deletion libexec/tofuenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-list
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-min-required
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-pin
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
4 changes: 2 additions & 2 deletions libexec/tofuenv-resolve-version
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down Expand Up @@ -71,7 +71,7 @@ declare version_requested version regex min_required version_file;

declare arg="${1:-""}";

if [ -z "${arg}" -a -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
if [ -z "${arg}" ] && [ -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
version_file="$(tofuenv-version-file)";
log 'debug' "Version File: ${version_file}";

Expand Down
4 changes: 2 additions & 2 deletions libexec/tofuenv-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down Expand Up @@ -64,7 +64,7 @@ done;
declare version_requested version regex;
declare arg="${1:-""}";

if [ -z "${arg:-""}" -a -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
if [ -z "${arg:-""}" ] && [ -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
version_file="$(tofuenv-version-file)";
log 'debug' "Version File: ${version_file}";
if [ "${version_file}" != "${TOFUENV_CONFIG_DIR}/version" ]; then
Expand Down
4 changes: 2 additions & 2 deletions libexec/tofuenv-use
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down Expand Up @@ -72,7 +72,7 @@ declare version_source_suffix="";
declare requested="${requested_arg}";
declare loaded_version_file="$(tofuenv-version-file)";

if [ -z "${requested_arg}" -a -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
if [ -z "${requested_arg}" ] && [ -z "${TOFUENV_TOFU_VERSION:-""}" ]; then
version_source_suffix=" (set by ${loaded_version_file})";

if [ -f "${loaded_version_file}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-version-file
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
2 changes: 1 addition & 1 deletion libexec/tofuenv-version-name
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand Down
28 changes: 14 additions & 14 deletions scripts/generate-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ __parent="$(dirname "$__dir")"
CHANGELOG_FILE_NAME="CHANGELOG.md"
CHANGELOG_TMP_FILE_NAME="CHANGELOG.tmp"
TARGET_SHA=$(git rev-parse HEAD)
PREVIOUS_RELEASE_SHA=$(git rev-list -n 1 $(git describe --abbrev=0 --match='v*.*.*' --tags))
PREVIOUS_RELEASE_SHA=$(git rev-list -n 1 "$(git describe --abbrev=0 --match='v*.*.*' --tags)")

if [ $TARGET_SHA == $PREVIOUS_RELEASE_SHA ]; then
if [ "$TARGET_SHA" == "$PREVIOUS_RELEASE_SHA" ]; then
echo "Nothing to do"
exit 0
fi

PREVIOUS_CHANGELOG=$(sed -n -e "/## $(git describe --abbrev=0 --match='v*.*.*' --tags | tr -d v)/,\$p" $__parent/$CHANGELOG_FILE_NAME)
PREVIOUS_CHANGELOG=$(sed -n -e "/## $(git describe --abbrev=0 --match='v*.*.*' --tags | tr -d v)/,\$p" "$__parent/$CHANGELOG_FILE_NAME")

if [ -z "$PREVIOUS_CHANGELOG" ]
then
echo "Unable to locate previous changelog contents."
exit 1
fi

CHANGELOG=$($(go env GOPATH)/bin/changelog-build -this-release $TARGET_SHA \
-last-release $PREVIOUS_RELEASE_SHA \
-git-dir $__parent \
CHANGELOG=$("$(go env GOPATH)/bin/changelog-build" -this-release "$TARGET_SHA" \
-last-release "$PREVIOUS_RELEASE_SHA" \
-git-dir "$__parent" \
-entries-dir .changelog \
-changelog-template $__dir/changelog.tmpl \
-note-template $__dir/release-note.tmpl)
-changelog-template "$__dir/changelog.tmpl" \
-note-template "$__dir/release-note.tmpl")

if [ -z "$CHANGELOG" ]
then
Expand All @@ -39,14 +39,14 @@ fi

rm -f $CHANGELOG_TMP_FILE_NAME

sed -n -e "1{/## /p;}" $__parent/$CHANGELOG_FILE_NAME > $CHANGELOG_TMP_FILE_NAME
echo "$CHANGELOG" >> $CHANGELOG_TMP_FILE_NAME
echo >> $CHANGELOG_TMP_FILE_NAME
echo "$PREVIOUS_CHANGELOG" >> $CHANGELOG_TMP_FILE_NAME
sed -n -e "1{/## /p;}" "$__parent/$CHANGELOG_FILE_NAME" > "$CHANGELOG_TMP_FILE_NAME"
echo "$CHANGELOG" >> "$CHANGELOG_TMP_FILE_NAME"
echo >> "$CHANGELOG_TMP_FILE_NAME"
echo "$PREVIOUS_CHANGELOG" >> "$CHANGELOG_TMP_FILE_NAME"

cp $CHANGELOG_TMP_FILE_NAME $CHANGELOG_FILE_NAME
cp "$CHANGELOG_TMP_FILE_NAME" "$CHANGELOG_FILE_NAME"

rm $CHANGELOG_TMP_FILE_NAME
rm "$CHANGELOG_TMP_FILE_NAME"

echo "Successfully generated changelog."

Expand Down
2 changes: 1 addition & 1 deletion test/install_deps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -uo pipefail;

if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
if [[ $(uname) == 'Darwin' ]] && [ "$(which brew)" ]; then
brew install grep;
fi;
6 changes: 3 additions & 3 deletions test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand All @@ -26,7 +26,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
};

TOFUENV_ROOT="$(cd "$(dirname "$(readlink_f "${0}")")/.." && pwd)";
[ -n ${TOFUENV_ROOT} ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
[ -n "${TOFUENV_ROOT}" ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
else
TOFUENV_ROOT="${TOFUENV_ROOT%/}";
fi;
Expand All @@ -51,7 +51,7 @@ export PATH="${TOFUENV_ROOT}/bin:${PATH}";

errors=();
if [ "${#}" -ne 0 ]; then
targets="$@";
targets="$*";
else
targets="$(\ls "$(dirname "${0}")" | grep 'test_')";
fi;
Expand Down
4 changes: 2 additions & 2 deletions test/test_install_and_use.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand All @@ -26,7 +26,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
};

TOFUENV_ROOT="$(cd "$(dirname "$(readlink_f "${0}")")/.." && pwd)";
[ -n ${TOFUENV_ROOT} ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
[ -n "${TOFUENV_ROOT}" ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
else
TOFUENV_ROOT="${TOFUENV_ROOT%/}";
fi;
Expand Down
4 changes: 2 additions & 2 deletions test/test_list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
local file_name;

while [ "${target_file}" != "" ]; do
cd "$(dirname ${target_file})" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
cd "$(dirname "${target_file}")" || early_death "Failed to 'cd \$(dirname ${target_file})' while trying to determine TOFUENV_ROOT";
file_name="$(basename "${target_file}")" || early_death "Failed to 'basename \"${target_file}\"' while trying to determine TOFUENV_ROOT";
target_file="$(readlink "${file_name}")";
done;
Expand All @@ -27,7 +27,7 @@ if [ -z "${TOFUENV_ROOT:-""}" ]; then
};

TOFUENV_ROOT="$(cd "$(dirname "$(readlink_f "${0}")")/.." && pwd)";
[ -n ${TOFUENV_ROOT} ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
[ -n "${TOFUENV_ROOT}" ] || early_death "Failed to 'cd \"\$(dirname \"\$(readlink_f \"${0}\")\")/..\" && pwd' while trying to determine TOFUENV_ROOT";
else
TOFUENV_ROOT="${TOFUENV_ROOT%/}";
fi;
Expand Down
Loading

0 comments on commit 12ea420

Please sign in to comment.