summaryrefslogtreecommitdiffhomepage
path: root/bash.html.markdown
diff options
context:
space:
mode:
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"}