updates slice function to use shell supported string slicing
This commit is contained in:
parent
bd2d3361c1
commit
b3df0985b1
1 changed files with 4 additions and 11 deletions
|
@ -18,17 +18,10 @@ function length {
|
||||||
}
|
}
|
||||||
|
|
||||||
function slice {
|
function slice {
|
||||||
STR=$3
|
start="$1"
|
||||||
AMT0=$1
|
end="$2"
|
||||||
AMT1=$2
|
string="$3"
|
||||||
|
echo "${string:${start}:${end}}"
|
||||||
LEN=$(length $STR)
|
|
||||||
BACK=$((LEN-AMT1))
|
|
||||||
|
|
||||||
RES0=$(trimfront $STR $AMT0)
|
|
||||||
RES1=$(trimend $RES0 $BACK)
|
|
||||||
|
|
||||||
echo $RES1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInterval {
|
function setInterval {
|
||||||
|
|
Loading…
Reference in a new issue