diff --git a/scripts/create-new-vartheme-bs4.sh b/scripts/create-new-vartheme-bs4.sh
index dc8bb0e7e78d5b1cfc216caa8d35a733818a0afc..3e91de1883aa2fea8810ea02fd3fd52de65659e3 100644
--- a/scripts/create-new-vartheme-bs4.sh
+++ b/scripts/create-new-vartheme-bs4.sh
@@ -36,23 +36,23 @@ current_path=$(pwd);
 drupal_root="$current_path";
 
 if [[ "${drupal_root: -1}" == "/" ]]; then
-  drupal_root="${drupal_root::-1}";
+  drupal_root="${drupal_root:0:${#drupal_root}-1}";
 fi
 
 if [[ "${drupal_root: -24}" == "profiles/varbase/scripts" ]]; then
-  drupal_root="${drupal_root::-24}";
+  drupal_root="${drupal_root:0:${#drupal_root}-24}";
 fi
 
 if [[ "${drupal_root: -16}" == "profiles/varbase" ]]; then
-  drupal_root="${drupal_root::-16}";
+  drupal_root="${drupal_root:0:${#drupal_root}-16}";
 fi
 
 if [[ "${drupal_root: -8}" == "profiles" ]]; then
-  drupal_root="${drupal_root::-8}";
+  drupal_root="${drupal_root:0:${#drupal_root}-8}";
 fi
 
 if [[ "${drupal_root: -1}" == "/" ]]; then
-  drupal_root="${drupal_root::-1}";
+  drupal_root="${drupal_root:0:${#drupal_root}-1}";
 fi
 
 echo "Current path: $current_path";