about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2016-06-29T21·59-0400
committerWilliam Carroll <wpcarro@gmail.com>2016-06-29T21·59-0400
commitb3df0985b109b69014404ceececbab8634feedb7 (patch)
tree60f47ecb4f607a75ed0d1c56222ffe780987c766
parentbd2d3361c14c96e2fb507bd54b4db466ff6aba09 (diff)
updates slice function to use shell supported string slicing
-rw-r--r--.js_to_bash.sh15
1 files changed, 4 insertions, 11 deletions
diff --git a/.js_to_bash.sh b/.js_to_bash.sh
index 1bbbcec3f92d..22a70a556077 100644
--- a/.js_to_bash.sh
+++ b/.js_to_bash.sh
@@ -18,17 +18,10 @@ function length {
 }
 
 function slice {
-    STR=$3
-    AMT0=$1
-    AMT1=$2
-
-    LEN=$(length $STR)
-    BACK=$((LEN-AMT1))
-
-    RES0=$(trimfront $STR $AMT0)
-    RES1=$(trimend $RES0 $BACK)
-
-    echo $RES1
+  start="$1"
+  end="$2"
+  string="$3"
+  echo "${string:${start}:${end}}"
 }
 
 function setInterval {