Index: tools/build-ccheck.sh
===================================================================
--- tools/build-ccheck.sh	(revision 5284faa97b1bbcf3adb6f3a8f5a3bfc1f2f514d2)
+++ tools/build-ccheck.sh	(revision 40c0483683dc49a028bfc7f0055e3ee5328111a2)
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) 2019 Jiri Svoboda
Index: tools/cc.sh
===================================================================
--- tools/cc.sh	(revision 5284faa97b1bbcf3adb6f3a8f5a3bfc1f2f514d2)
+++ tools/cc.sh	(revision 40c0483683dc49a028bfc7f0055e3ee5328111a2)
@@ -1,3 +1,3 @@
-#! /bin/bash
+#!/bin/sh
 
 #
Index: tools/ccheck.sh
===================================================================
--- tools/ccheck.sh	(revision 5284faa97b1bbcf3adb6f3a8f5a3bfc1f2f514d2)
+++ tools/ccheck.sh	(revision 40c0483683dc49a028bfc7f0055e3ee5328111a2)
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/bin/sh
 #
 # Copyright (c) 2018 Jiri Svoboda
@@ -33,5 +33,5 @@
 fi
 
-if [ ."$1" == .--fix ] ; then
+if [ ."$1" = .--fix ]; then
 	opt=--fix
 else
@@ -49,6 +49,5 @@
 	outfile="$(mktemp)"
 	"$ccheck" $opt $fname >"$outfile" 2>&1
-	rc=$?
-	if [ .$rc == .0 ]; then
+	if [ $? -eq 0 ]; then
 		if [ -s "$outfile" ] ; then
 			srepcnt=$((srepcnt + 1))
@@ -65,5 +64,5 @@
 done
 
-if [ $srepcnt == 0 -a $fcnt == 0 ] ; then
+if [ $srepcnt -eq 0 ] && [ $fcnt -eq 0 ]; then
 	echo "Ccheck passed."
 else
Index: tools/toolchain.sh
===================================================================
--- tools/toolchain.sh	(revision 5284faa97b1bbcf3adb6f3a8f5a3bfc1f2f514d2)
+++ tools/toolchain.sh	(revision 40c0483683dc49a028bfc7f0055e3ee5328111a2)
@@ -1,3 +1,3 @@
-#! /bin/bash
+#!/bin/sh
 
 #
@@ -103,8 +103,8 @@
 	echo
 	
-	if [ -z "$1" ] || [ "$1" == "all" ] ; then
-		PLATFORMS=("amd64" "arm32" "arm64" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
+	if [ -z "$1" ] || [ "$1" = "all" ] ; then
+		PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64'
 	else
-		PLATFORMS=("$1")
+		PLATFORMS="$1"
 	fi
 	
@@ -114,5 +114,5 @@
 	fi
 
-	for i in "${PLATFORMS[@]}"
+	for i in $PLATFORMS
 	do
 		PLATFORM="$i"
@@ -121,7 +121,7 @@
 
 		echo "== $PLATFORM =="
-		test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
-		test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
-		test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
+		test_app_version "Binutils" "ld" "GNU ld (.*) \([.0-9]*\)" "$BINUTILS_VERSION"
+		test_app_version "GCC" "gcc" "gcc version \([.0-9]*\)" "$GCC_VERSION"
+		test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION"
 	done
 
@@ -140,18 +140,16 @@
 		echo "- $PKGNAME is missing"
 	else
-		{
-			OUT=$(${APP} -v 2>&1)
-		} &> /dev/null
-
-		if [[ "$OUT" =~ $REGEX ]]; then
-	        VERSION="${BASH_REMATCH[1]}"
-	        if [ "$INS_VERSION" = "$VERSION" ]; then
-	        	echo "+ $PKGNAME is uptodate ($INS_VERSION)"
-	        else
-	        	echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
-	        fi
-	    else
-	        echo "- $PKGNAME Unexpected output"
-	    fi
+		VERSION=`${APP} -v 2>&1 | sed -n "s:^${REGEX}.*:\1:p"`
+
+		if [ -z "$VERSION" ]; then
+			echo "- $PKGNAME Unexpected output"
+			return 1
+		fi
+
+		if [ "$INS_VERSION" = "$VERSION" ]; then
+			echo "+ $PKGNAME is uptodate ($INS_VERSION)"
+		else
+			echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
+		fi
 	fi
 }
@@ -160,5 +158,5 @@
 
 change_title() {
-	echo -en "\e]0;$1\a"
+	printf "\e]0;$1\a"
 }
 
@@ -171,5 +169,5 @@
 	fi
 
-	echo -n "${TM} "
+	printf "${TM} "
 	change_title "${TM}"
 	sleep 1
@@ -222,28 +220,29 @@
 	OUTSIDE="$1"
 	BASE="$2"
-	ORIGINAL="`pwd`"
+	ORIGINAL="$PWD"
+
+	cd "${BASE}"
+	check_error $? "Unable to change directory to ${BASE}."
+	ABS_BASE="$PWD"
+	cd "${ORIGINAL}"
+	check_error $? "Unable to change directory to ${ORIGINAL}."
 
 	mkdir -p "${OUTSIDE}"
-
 	cd "${OUTSIDE}"
 	check_error $? "Unable to change directory to ${OUTSIDE}."
-	ABS_OUTSIDE="`pwd`"
-
-	cd "${BASE}"
-	check_error $? "Unable to change directory to ${BASE}."
-	ABS_BASE="`pwd`"
+
+	while [ "${#PWD}" -gt "${#ABS_BASE}" ]; do
+		cd ..
+	done
+
+	if [ "$PWD" = "$ABS_BASE" ]; then
+		echo
+		echo "CROSS_PREFIX cannot reside within the working directory."
+
+		exit 5
+	fi
 
 	cd "${ORIGINAL}"
 	check_error $? "Unable to change directory to ${ORIGINAL}."
-
-	BASE_LEN="${#ABS_BASE}"
-	OUTSIDE_TRIM="${ABS_OUTSIDE:0:${BASE_LEN}}"
-
-	if [ "${OUTSIDE_TRIM}" == "${ABS_BASE}" ] ; then
-		echo
-		echo "CROSS_PREFIX cannot reside within the working directory."
-
-		exit 5
-	fi
 }
 
