From bbbc214ffbe7847d7d4023645122116dc1749c37 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 18 Jun 2013 14:35:30 +0200 Subject: [PATCH] Remove bashisms, replace with POSIX constructs This replaces double conditional brackets with single ones and gets ris of bashisms, so that the tool should be sourcable from any POSIX shell. Constructs like [ $foo = "$bar"* ] yield filesystem-globbing behaviour according to POSIX. A compliant way is to use case statements. Signed-off-by: martin f. krafft --- hacking/env-setup | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hacking/env-setup b/hacking/env-setup index bcebd46250..9bf3c49b31 100755 --- a/hacking/env-setup +++ b/hacking/env-setup @@ -20,14 +20,23 @@ PREFIX_PYTHONPATH="$ANSIBLE_HOME/lib" PREFIX_PATH="$ANSIBLE_HOME/bin" PREFIX_MANPATH="$ANSIBLE_HOME/docs/man" -[[ "$PYTHONPATH" != "${PREFIX_PYTHONPATH}"* ]] && export PYTHONPATH=$"PREFIX_PYTHONPATH:$PYTHONPATH" -[[ "$PATH" != "${PREFIX_PATH}"* ]] && export PATH="$PREFIX_PATH:$PATH" +case "$PYTHONPATH" in + (*${PREFIX_PYTHONPATH}*) :;; + (*) export PYTHONPATH=$"$PREFIX_PYTHONPATH${PYTHONPATH:+:$PYTHONPATH}";; +esac +case "$MANPATH" in + (*${PREFIX_MANPATH}*) :;; + (*) export MANPATH=$"$PREFIX_MANPATH${MANPATH:+:$MANPATH}";; +esac +case "$PATH" in + (*${PREFIX_PATH}*) :;; + (*) export PATH=$"$PREFIX_PATH${PATH:+:$PATH}";; +esac export ANSIBLE_LIBRARY="$ANSIBLE_HOME/library" -[[ "$MANPATH" != "${PREFIX_MANPATH}"* ]] && export MANPATH="$PREFIX_MANPATH:$MANPATH" # Print out values unless -q is set -if [ $# -eq 0 -o "$1" != "-q" ] ; then +if [ $# -eq 0 ] || [ "$1" != "-q" ] ; then echo "" echo "Setting up Ansible to run out of checkout..." echo ""