Skip to content

Commit

Permalink
fix: slightly adjust shell check
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoomTen committed Jun 25, 2024
1 parent 5e655f3 commit 49dd8b1
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions rgbenv
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# Prevent boundless recursion
if [ -z "${RGBENV_REEXEC_COUNT}" ]; then
RGBENV_REEXEC_COUNT=0
else
RGBENV_REEXEC_COUNT=$(expr ${RGBENV_REEXEC_COUNT} + 1)
if ! (command -v bash 2>&1 > /dev/null); then
echo "Sorry, rgbenv requires bash."
exit 1
fi
export RGBENV_REEXEC_COUNT

if (command -v bash 2>&1 > /dev/null); then
if [ "${SHELL}" = "$(command -v bash)" ]; then
if [ "${RGBENV_REEXEC_COUNT}" -gt 1 ]; then
exit
fi
if [ "${SHELL}" != "$(command -v bash)" ]; then
# Prevent boundless recursion
if [ -z "${REEXEC_COUNT}" ]; then
RGBENV_REEXEC_COUNT=0
else
exec /usr/bin/env bash "${0}" "${@}"
RGBENV_REEXEC_COUNT=$(expr ${RGBENV_REEXEC_COUNT} + 1)
fi
else
echo "Sorry, rgbenv requires bash."
exit 1
export RGBENV_REEXEC_COUNT

if [ "${RGBENV_REEXEC_COUNT}" -gt 1 ]; then
exit
fi

exec /usr/bin/env bash "${0}" "${@}"
fi


set -euo pipefail

# --------------- Constant defines -------------------------------------------------
Expand Down

0 comments on commit 49dd8b1

Please sign in to comment.