diff --git a/iiab-install b/iiab-install index 58ac12191..d9d62869f 100755 --- a/iiab-install +++ b/iiab-install @@ -54,7 +54,13 @@ fi # Verify that a recent enough version of Ansible is installed. See #449. The # "include:" command was inconsistently implemented prior to Ansible 2.4.x.x CURR_ANSIBLE_VER=0 -if type -P ansible ; then +#if [ $(grep ubuntu /etc/apt/sources.list) ]; then # FAILS when multiple lines returned, due to single square brackets +#if grep -q ubuntu /etc/apt/sources.list ; then # Works: bypasses need for "> /dev/null" thanks to "grep -q" (quiet) +#if command -v ansible > /dev/null ; then # Works But Wordy! +#if [[ $(command -v ansible) ]]; then # Also Works! $(...) nests more easily than backticks +#if [[ `which ansible` ]]; then # "which" misses built-in commands like cd, and is RISKY per https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script +#if [[ `type -P ansible` ]]; then # "type -P" isn't POSIX compliant; it misses built-in commands like "cd" +if [[ `command -v ansible` ]]; then # "command -v" is POSIX compliant; it catches built-in commands like "cd" #CURR_ANSIBLE_VER=`ansible --version | head -1 | sed -e 's/.* //'` #CURR_ANSIBLE_VER=`ansible --version | head -1 | cut -f 2 -d " "` CURR_ANSIBLE_VER=`ansible --version | head -1 | awk '{print $2}'`