bash: Use specific length of characters of a variable.
-
Take into account the main readme for this section. README first.
Syntax is:
${name:start} or ${name:start:length} count begins with zeroHere we start the count at 4
$ ClimateChange=LessDeforestation $ Amazon=${ClimateChange:4} $ echo $Amazon Deforestation
Using the start count with a length. First a length of 2 and both start count and the length can be arithmetic expressions.
$ Amazon=${ClimateChange:4:2} $ echo $Amazon De $ Amazon=${ClimateChange:4:-2} $ echo $Amazon Deforestati
© Lightnetics 2024