summaryrefslogtreecommitdiffhomepage
path: root/bash.html.markdown
diff options
context:
space:
mode:
authorMartin Nicholson <recyclebing+github@gmail.com>2018-01-16 15:27:30 +0000
committerMartin Nicholson <recyclebing+github@gmail.com>2018-01-16 15:27:30 +0000
commitf39df1da097f8718b375127ad04f2114c5c4e48d (patch)
tree79a1bd8772927ae9466577323785a5fc65975e71 /bash.html.markdown
parent70a36c9bd970b928adde06afb2bd69f6ba8e5d5c (diff)
Added second substring example
Diffstat (limited to 'bash.html.markdown')
-rw-r--r--bash.html.markdown3
1 files changed, 3 insertions, 0 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index 0c097c27..ed4fa54f 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -16,6 +16,7 @@ contributors:
- ["Betsy Lorton", "https://github.com/schbetsy"]
- ["John Detter", "https://github.com/jdetter"]
- ["Harry Mumford-Turner", "https://github.com/harrymt"]
+ - ["Martin Nicholson", "https://github.com/mn113"]
filename: LearnBash.sh
---
@@ -76,6 +77,8 @@ echo ${Variable/Some/A} # => A string
Length=7
echo ${Variable:0:Length} # => Some st
# This will return only the first 7 characters of the value
+echo ${Variable: -Length}
+# This will return the last 7 characters (note the space before -Length)
# Default value for variable
echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}