mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-09 16:26:53 +02:00
Clear that length and position can be set by variable in substring extraction
This commit is contained in:
@@ -59,7 +59,8 @@ echo ${VARIABLE/Some/A}
|
|||||||
# This will substitute the first occurance of "Some" with "A"
|
# This will substitute the first occurance of "Some" with "A"
|
||||||
|
|
||||||
# Substring from a variable
|
# 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
|
# This will return only the first 7 characters of the value
|
||||||
|
|
||||||
# Default value for variable
|
# Default value for variable
|
||||||
|
Reference in New Issue
Block a user