diff --git a/meson.build b/meson.build
index 6c092bf2060f8ea57054f5189330420f8454406c..d7654aee562408e8c26547e31fd55742215e1d4c 100644
--- a/meson.build
+++ b/meson.build
@@ -508,7 +508,8 @@ _include_search_paths = [
     '/usr/local/include',
 ] 
 foreach idir : _include_search_paths
-    if run_command('sh','-c','meson/directory_exists.sh',idir).returncode() == 0
+    _ret = run_command('sh','-c','meson/directory_exists.sh',idir).returncode()
+    if _ret == 0
         inc_arg = idir
         _Inc_arg = '-I' + idir
         if not found and compiler.has_header('gsl/gsl_blas.h',
@@ -521,7 +522,6 @@ endforeach
 
 incdirs += [ my_incdirs ]
 
-
 ############################################################
 # features which are converted into preprocessor flags (-D)
 #
diff --git a/meson/directory_exists.sh b/meson/directory_exists.sh
index 43fe49a4cde104a0f774d4c066d3d25e58d5bb51..1e046fc7976b9e76b9454f7bf0cd87f5da831f64 100755
--- a/meson/directory_exists.sh
+++ b/meson/directory_exists.sh
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/sh
 
 # return 0 if directory exists, 1 otherwise
-if [[ -d "$1" ]]; then
+if [ -d "$1" ]; then
     exit 0;
 else
     exit 1;