summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-05-02 20:55:31 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-05-02 20:55:31 -0500
commitba76fa9f8fad6656c13a87bfd016f16edf9b0c35 (patch)
tree810e8230d52041c7d0f1711a40e42ca597903bfa
parentd26900150d07a6a8ebc9860e2cef5a291b93749e (diff)
parent8758bb845b063b76b55d2c178d0dc393b2a39c5c (diff)
Merge pull request #1079 from kryzhovnik/bash/string-substitution
Clear that length and position can be set by a variable in substring extraction
-rw-r--r--bash.html.markdown3
1 files changed, 2 insertions, 1 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index e0c12f97..81f85d28 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -59,7 +59,8 @@ echo ${VARIABLE/Some/A}
# This will substitute the first occurance of "Some" with "A"
# Substring from a variable
-echo ${VARIABLE:0:7}
+LENGTH=7
+echo ${VARIABLE:0:LENGTH}
# This will return only the first 7 characters of the value
# Default value for variable