summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2015-04-27 22:31:05 -0500
committerLevi Bostian <levi.bostian@gmail.com>2015-04-27 22:31:05 -0500
commitf4beb3bea956775664c64cb8f1973a816fbac224 (patch)
tree387aed62010a1f8b8ed882dccec61b064efa2f4e
parentbb9caecca449c6615f7c7d0bc98de7f415bc8f89 (diff)
parentaa11cc659de990a6c4d4104bcc733f373b079ae7 (diff)
Merge pull request #1069 from deryni/common-bash-variable-assignment-mistake
[bash/en] Add another common bash variable assignment mistake
-rw-r--r--bash.html.markdown10
1 files changed, 9 insertions, 1 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index 35bed9a2..e0c12f97 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -10,6 +10,7 @@ contributors:
- ["Anton Strömkvist", "http://lutic.org/"]
- ["Rahil Momin", "https://github.com/iamrahil"]
- ["Gregrory Kielian", "https://github.com/gskielian"]
+ - ["Etan Reisner", "https://github.com/deryni"]
filename: LearnBash.sh
---
@@ -36,7 +37,14 @@ VARIABLE="Some string"
# But not like this:
VARIABLE = "Some string"
# Bash will decide that VARIABLE is a command it must execute and give an error
-# because it couldn't be found.
+# because it can't be found.
+
+# Or like this:
+VARIABLE= 'Some string'
+# Bash will decide that 'Some string' is a command it must execute and give an
+# error because it can't be found. (In this case the 'VARIABLE=' part is seen
+# as a variable assignment valid only for the scope of the 'Some string'
+# command.)
# Using the variable:
echo $VARIABLE