diff --git a/bin/dunecontrol b/bin/dunecontrol
index 308af370b4d956ebcc206dfe8958147a638902ca..280f7aff9cb5a6823ba4abcf3fabb8bff5155d3e 100755
--- a/bin/dunecontrol
+++ b/bin/dunecontrol
@@ -6,6 +6,12 @@ set -e
 ###
 ### check for environment variables
 ###
+if test -z "$GREP"; then
+  GREP=grep
+fi
+if test -z "$SED"; then
+  SED=sed
+fi
 
 if test -z "$MAKE"; then
   MAKE=make
@@ -15,6 +21,10 @@ if test -z "$CMAKE"; then
   CMAKE=cmake
 fi
 
+space=" "
+tab="	"
+BLANK="$space$tab"
+
 ###############################################
 ###
 ### read lib
@@ -220,16 +230,6 @@ abs_builddir()
   esac
 }
 
-space=" "
-tab="	"
-BLANK="$space$tab"
-
-if test -z "$GREP"; then
-  GREP=grep
-fi
-if test -z "$SED"; then
-  SED=sed
-fi
 # Uses the current compiler to extract information about the
 # multiarch triplets and sets the export variable MULTIARCH_LIBDIR
 # according to it.