--- a/src/build.c
+++ b/src/build.c
@@ -713,7 +713,7 @@
 static void build_spawn_cmd(GeanyDocument *doc, const gchar *cmd, const gchar *dir)
 {
 	GError *error = NULL;
-	const gchar *argv[] = { "/bin/sh", "-c", NULL, NULL };
+	const gchar *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", NULL, NULL };
 	gchar *working_dir;
 	gchar *utf8_working_dir;
 	gchar *cmd_string;
@@ -869,7 +869,7 @@
 		if (vte_config.skip_run_script)
 			vte_cmd = g_strconcat(run_cmd, "\n", NULL);
 		else
-			vte_cmd = g_strconcat("\n/bin/sh ", run_cmd, "\n", NULL);
+			vte_cmd = g_strconcat("\n@TERMUX_PREFIX@/bin/sh ", run_cmd, "\n", NULL);
 
 		vte_cwd(working_dir, TRUE);
 		if (! vte_send_cmd(vte_cmd))
@@ -1103,7 +1103,7 @@
 
 	escaped_dir = g_shell_quote(working_dir);
 	str = g_strdup_printf(
-		"#!/bin/sh\n\nrm $0\n\ncd %s\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
+		"#!@TERMUX_PREFIX@/bin/sh\n\nrm $0\n\ncd %s\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
 		\n\n%s\n", escaped_dir, cmd, (autoclose) ? "" :
 		"\necho \"Press return to continue\"\n#to be more compatible with shells like "
 			"dash\ndummy_var=\"\"\nread dummy_var");
