mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
Merge pull request #1079 from kryzhovnik/bash/string-substitution
Clear that length and position can be set by a variable in substring extraction
This commit is contained in:
commit
ba76fa9f8f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user