diff --git a/tests/run_examples.sh b/tests/run_examples.sh
index 5c57df61a792abbbc9afcf8b364c2b9b090b4f48..ff01644e97091c0c6ba0f006418aa8b953c2de98 100755
--- a/tests/run_examples.sh
+++ b/tests/run_examples.sh
@@ -55,7 +55,9 @@ export EXAMPLES_DIR
 CPU_CORES=$(nproc --all)
 
 # Build debug binary
-if [ -n "$RUSTUP" ] && [ "$RUSTUP" -eq 1 ]; then
+# Check if the variabl $RUSTUP is set. If yes the $TOOLCHAIN can be choosen via cargo, otherwise cargo might not now
+# about that feature.
+if [ -v RUSTUP ]; then
 	cargo +$TOOLCHAIN build
 else
 	cargo build