From 8758bb845b063b76b55d2c178d0dc393b2a39c5c Mon Sep 17 00:00:00 2001 From: Andrey Samsonov Date: Sat, 2 May 2015 15:34:56 +0400 Subject: Clear that length and position can be set by variable in substring extraction --- bash.html.markdown | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3