diff --git a/bin/exercise_test.ps1 b/bin/exercise_test.ps1 index 7a2bb33b..b700fa67 100644 --- a/bin/exercise_test.ps1 +++ b/bin/exercise_test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/bin/exercise_test.sh b/bin/exercise_test.sh index 7b4a9da0..47e25f10 100644 --- a/bin/exercise_test.sh +++ b/bin/exercise_test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/acronym/test.ps1 b/exercises/practice/acronym/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/acronym/test.ps1 +++ b/exercises/practice/acronym/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/acronym/test.sh b/exercises/practice/acronym/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/acronym/test.sh +++ b/exercises/practice/acronym/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/all-your-base/test.ps1 b/exercises/practice/all-your-base/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/all-your-base/test.ps1 +++ b/exercises/practice/all-your-base/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/all-your-base/test.sh b/exercises/practice/all-your-base/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/all-your-base/test.sh +++ b/exercises/practice/all-your-base/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/allergies/test.ps1 b/exercises/practice/allergies/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/allergies/test.ps1 +++ b/exercises/practice/allergies/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/allergies/test.sh b/exercises/practice/allergies/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/allergies/test.sh +++ b/exercises/practice/allergies/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/anagram/test.ps1 b/exercises/practice/anagram/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/anagram/test.ps1 +++ b/exercises/practice/anagram/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/anagram/test.sh b/exercises/practice/anagram/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/anagram/test.sh +++ b/exercises/practice/anagram/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/armstrong-numbers/test.ps1 b/exercises/practice/armstrong-numbers/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/armstrong-numbers/test.ps1 +++ b/exercises/practice/armstrong-numbers/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/armstrong-numbers/test.sh b/exercises/practice/armstrong-numbers/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/armstrong-numbers/test.sh +++ b/exercises/practice/armstrong-numbers/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/atbash-cipher/test.ps1 b/exercises/practice/atbash-cipher/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/atbash-cipher/test.ps1 +++ b/exercises/practice/atbash-cipher/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/atbash-cipher/test.sh b/exercises/practice/atbash-cipher/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/atbash-cipher/test.sh +++ b/exercises/practice/atbash-cipher/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/binary-search/test.ps1 b/exercises/practice/binary-search/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/binary-search/test.ps1 +++ b/exercises/practice/binary-search/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/binary-search/test.sh b/exercises/practice/binary-search/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/binary-search/test.sh +++ b/exercises/practice/binary-search/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/binary/test.ps1 b/exercises/practice/binary/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/binary/test.ps1 +++ b/exercises/practice/binary/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/binary/test.sh b/exercises/practice/binary/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/binary/test.sh +++ b/exercises/practice/binary/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/bob/test.ps1 b/exercises/practice/bob/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/bob/test.ps1 +++ b/exercises/practice/bob/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/bob/test.sh b/exercises/practice/bob/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/bob/test.sh +++ b/exercises/practice/bob/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/circular-buffer/test.ps1 b/exercises/practice/circular-buffer/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/circular-buffer/test.ps1 +++ b/exercises/practice/circular-buffer/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/circular-buffer/test.sh b/exercises/practice/circular-buffer/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/circular-buffer/test.sh +++ b/exercises/practice/circular-buffer/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/collatz-conjecture/test.ps1 b/exercises/practice/collatz-conjecture/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/collatz-conjecture/test.ps1 +++ b/exercises/practice/collatz-conjecture/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/collatz-conjecture/test.sh b/exercises/practice/collatz-conjecture/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/collatz-conjecture/test.sh +++ b/exercises/practice/collatz-conjecture/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/complex-numbers/test.ps1 b/exercises/practice/complex-numbers/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/complex-numbers/test.ps1 +++ b/exercises/practice/complex-numbers/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/complex-numbers/test.sh b/exercises/practice/complex-numbers/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/complex-numbers/test.sh +++ b/exercises/practice/complex-numbers/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/darts/test.ps1 b/exercises/practice/darts/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/darts/test.ps1 +++ b/exercises/practice/darts/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/darts/test.sh b/exercises/practice/darts/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/darts/test.sh +++ b/exercises/practice/darts/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/diamond/test.ps1 b/exercises/practice/diamond/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/diamond/test.ps1 +++ b/exercises/practice/diamond/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/diamond/test.sh b/exercises/practice/diamond/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/diamond/test.sh +++ b/exercises/practice/diamond/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/difference-of-squares/test.ps1 b/exercises/practice/difference-of-squares/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/difference-of-squares/test.ps1 +++ b/exercises/practice/difference-of-squares/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/difference-of-squares/test.sh b/exercises/practice/difference-of-squares/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/difference-of-squares/test.sh +++ b/exercises/practice/difference-of-squares/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/eliuds-eggs/test.ps1 b/exercises/practice/eliuds-eggs/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/eliuds-eggs/test.ps1 +++ b/exercises/practice/eliuds-eggs/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/eliuds-eggs/test.sh b/exercises/practice/eliuds-eggs/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/eliuds-eggs/test.sh +++ b/exercises/practice/eliuds-eggs/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/grade-school/test.ps1 b/exercises/practice/grade-school/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/grade-school/test.ps1 +++ b/exercises/practice/grade-school/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/grade-school/test.sh b/exercises/practice/grade-school/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/grade-school/test.sh +++ b/exercises/practice/grade-school/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/hamming/test.ps1 b/exercises/practice/hamming/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/hamming/test.ps1 +++ b/exercises/practice/hamming/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/hamming/test.sh b/exercises/practice/hamming/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/hamming/test.sh +++ b/exercises/practice/hamming/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/hello-world/test.ps1 b/exercises/practice/hello-world/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/hello-world/test.ps1 +++ b/exercises/practice/hello-world/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/hello-world/test.sh b/exercises/practice/hello-world/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/hello-world/test.sh +++ b/exercises/practice/hello-world/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/high-scores/test.ps1 b/exercises/practice/high-scores/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/high-scores/test.ps1 +++ b/exercises/practice/high-scores/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/high-scores/test.sh b/exercises/practice/high-scores/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/high-scores/test.sh +++ b/exercises/practice/high-scores/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/isogram/test.ps1 b/exercises/practice/isogram/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/isogram/test.ps1 +++ b/exercises/practice/isogram/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/isogram/test.sh b/exercises/practice/isogram/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/isogram/test.sh +++ b/exercises/practice/isogram/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/knapsack/test.ps1 b/exercises/practice/knapsack/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/knapsack/test.ps1 +++ b/exercises/practice/knapsack/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/knapsack/test.sh b/exercises/practice/knapsack/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/knapsack/test.sh +++ b/exercises/practice/knapsack/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/leap/test.ps1 b/exercises/practice/leap/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/leap/test.ps1 +++ b/exercises/practice/leap/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/leap/test.sh b/exercises/practice/leap/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/leap/test.sh +++ b/exercises/practice/leap/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/luhn/test.ps1 b/exercises/practice/luhn/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/luhn/test.ps1 +++ b/exercises/practice/luhn/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/luhn/test.sh b/exercises/practice/luhn/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/luhn/test.sh +++ b/exercises/practice/luhn/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/matching-brackets/test.ps1 b/exercises/practice/matching-brackets/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/matching-brackets/test.ps1 +++ b/exercises/practice/matching-brackets/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/matching-brackets/test.sh b/exercises/practice/matching-brackets/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/matching-brackets/test.sh +++ b/exercises/practice/matching-brackets/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/meetup/test.ps1 b/exercises/practice/meetup/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/meetup/test.ps1 +++ b/exercises/practice/meetup/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/meetup/test.sh b/exercises/practice/meetup/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/meetup/test.sh +++ b/exercises/practice/meetup/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/nucleotide-count/test.ps1 b/exercises/practice/nucleotide-count/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/nucleotide-count/test.ps1 +++ b/exercises/practice/nucleotide-count/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/nucleotide-count/test.sh b/exercises/practice/nucleotide-count/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/nucleotide-count/test.sh +++ b/exercises/practice/nucleotide-count/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/pangram/test.ps1 b/exercises/practice/pangram/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/pangram/test.ps1 +++ b/exercises/practice/pangram/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/pangram/test.sh b/exercises/practice/pangram/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/pangram/test.sh +++ b/exercises/practice/pangram/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/pascals-triangle/test.ps1 b/exercises/practice/pascals-triangle/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/pascals-triangle/test.ps1 +++ b/exercises/practice/pascals-triangle/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/pascals-triangle/test.sh b/exercises/practice/pascals-triangle/test.sh index 7b4a9da0..47e25f10 100644 --- a/exercises/practice/pascals-triangle/test.sh +++ b/exercises/practice/pascals-triangle/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/pig-latin/test.ps1 b/exercises/practice/pig-latin/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/pig-latin/test.ps1 +++ b/exercises/practice/pig-latin/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/pig-latin/test.sh b/exercises/practice/pig-latin/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/pig-latin/test.sh +++ b/exercises/practice/pig-latin/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/protein-translation/test.ps1 b/exercises/practice/protein-translation/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/protein-translation/test.ps1 +++ b/exercises/practice/protein-translation/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/protein-translation/test.sh b/exercises/practice/protein-translation/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/protein-translation/test.sh +++ b/exercises/practice/protein-translation/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/queen-attack/test.ps1 b/exercises/practice/queen-attack/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/queen-attack/test.ps1 +++ b/exercises/practice/queen-attack/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/queen-attack/test.sh b/exercises/practice/queen-attack/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/queen-attack/test.sh +++ b/exercises/practice/queen-attack/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/raindrops/test.ps1 b/exercises/practice/raindrops/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/raindrops/test.ps1 +++ b/exercises/practice/raindrops/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/raindrops/test.sh b/exercises/practice/raindrops/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/raindrops/test.sh +++ b/exercises/practice/raindrops/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/reverse-string/test.ps1 b/exercises/practice/reverse-string/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/reverse-string/test.ps1 +++ b/exercises/practice/reverse-string/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/reverse-string/test.sh b/exercises/practice/reverse-string/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/reverse-string/test.sh +++ b/exercises/practice/reverse-string/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/rna-transcription/test.ps1 b/exercises/practice/rna-transcription/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/rna-transcription/test.ps1 +++ b/exercises/practice/rna-transcription/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/rna-transcription/test.sh b/exercises/practice/rna-transcription/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/rna-transcription/test.sh +++ b/exercises/practice/rna-transcription/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/robot-simulator/test.ps1 b/exercises/practice/robot-simulator/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/robot-simulator/test.ps1 +++ b/exercises/practice/robot-simulator/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/robot-simulator/test.sh b/exercises/practice/robot-simulator/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/robot-simulator/test.sh +++ b/exercises/practice/robot-simulator/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/roman-numerals/test.ps1 b/exercises/practice/roman-numerals/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/roman-numerals/test.ps1 +++ b/exercises/practice/roman-numerals/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/roman-numerals/test.sh b/exercises/practice/roman-numerals/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/roman-numerals/test.sh +++ b/exercises/practice/roman-numerals/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/rotational-cipher/test.ps1 b/exercises/practice/rotational-cipher/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/rotational-cipher/test.ps1 +++ b/exercises/practice/rotational-cipher/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/rotational-cipher/test.sh b/exercises/practice/rotational-cipher/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/rotational-cipher/test.sh +++ b/exercises/practice/rotational-cipher/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/scrabble-score/test.ps1 b/exercises/practice/scrabble-score/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/scrabble-score/test.ps1 +++ b/exercises/practice/scrabble-score/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/scrabble-score/test.sh b/exercises/practice/scrabble-score/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/scrabble-score/test.sh +++ b/exercises/practice/scrabble-score/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/secret-handshake/test.ps1 b/exercises/practice/secret-handshake/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/secret-handshake/test.ps1 +++ b/exercises/practice/secret-handshake/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/secret-handshake/test.sh b/exercises/practice/secret-handshake/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/secret-handshake/test.sh +++ b/exercises/practice/secret-handshake/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/sieve/test.ps1 b/exercises/practice/sieve/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/sieve/test.ps1 +++ b/exercises/practice/sieve/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/sieve/test.sh b/exercises/practice/sieve/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/sieve/test.sh +++ b/exercises/practice/sieve/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/space-age/test.ps1 b/exercises/practice/space-age/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/space-age/test.ps1 +++ b/exercises/practice/space-age/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/space-age/test.sh b/exercises/practice/space-age/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/space-age/test.sh +++ b/exercises/practice/space-age/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/square-root/test.ps1 b/exercises/practice/square-root/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/square-root/test.ps1 +++ b/exercises/practice/square-root/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/square-root/test.sh b/exercises/practice/square-root/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/square-root/test.sh +++ b/exercises/practice/square-root/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/triangle/test.ps1 b/exercises/practice/triangle/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/triangle/test.ps1 +++ b/exercises/practice/triangle/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/triangle/test.sh b/exercises/practice/triangle/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/triangle/test.sh +++ b/exercises/practice/triangle/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/two-fer/test.ps1 b/exercises/practice/two-fer/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/two-fer/test.ps1 +++ b/exercises/practice/two-fer/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/two-fer/test.sh b/exercises/practice/two-fer/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/two-fer/test.sh +++ b/exercises/practice/two-fer/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck diff --git a/exercises/practice/yacht/test.ps1 b/exercises/practice/yacht/test.ps1 index 7a2bb33b..b700fa67 100644 --- a/exercises/practice/yacht/test.ps1 +++ b/exercises/practice/yacht/test.ps1 @@ -1,7 +1,11 @@ $slug=Split-Path $PSScriptRoot -Leaf $cobolcheck = Join-Path -Path "${HOME}" "cobolcheck" "cobolcheck.exe" +$cobolcheckCmd = Get-Command "cobolcheck.exe" -ErrorAction SilentlyContinue -if (![System.IO.File]::Exists("$cobolcheck")){ +if ($cobolcheckCmd) { + $cobolcheck = $cobolcheckCmd.Path + Write-Output "Found cobolcheck, using $cobolcheck" +} elseif (![System.IO.File]::Exists("$cobolcheck")){ $fetchCobolcheckPath = Join-Path -Path "${PSScriptRoot}" "bin" "fetch-cobolcheck.ps1" echo $fetchCobolcheckPath Write-Output "Cobolcheck not found. Trying to fetch it." diff --git a/exercises/practice/yacht/test.sh b/exercises/practice/yacht/test.sh index 7b4a9da0..47e25f10 100755 --- a/exercises/practice/yacht/test.sh +++ b/exercises/practice/yacht/test.sh @@ -3,7 +3,11 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/ SLUG=${1:-$(basename "${SCRIPT_DIR}")} COBOLCHECK="${HOME}/cobolcheck/cobolcheck" -if [ ! -f "${COBOLCHECK}" ]; then +WHICH_COBOLCHECK=$(which cobolcheck) +if [[ $? -eq 0 ]] ; then + echo "Found cobolcheck, using $COBOLCHECK" + COBOLCHECK=$WHICH_COBOLCHECK +elif [ ! -f "${COBOLCHECK}" ]; then echo "Cobolcheck not found, try to fetch it." cd $SCRIPT_DIR/bin/ bash fetch-cobolcheck