summaryrefslogtreecommitdiffhomepage
path: root/bash.html.markdown
diff options
context:
space:
mode:
authorsarthfrey <sarth.frey@gmail.com>2016-01-25 18:26:23 -0500
committersarthfrey <sarth.frey@gmail.com>2016-01-25 18:26:23 -0500
commit279c28ce7dcc3f155f71c7a073e939630e8f05b6 (patch)
treecd06525da5a4350916143f025b2e5a64a56922aa /bash.html.markdown
parent299d064ecf7598144e49ef336e0abd00ccc4ae16 (diff)
parent928edf12092cea82a9eded6848b8d0b0710a977c (diff)
Merge remote-tracking branch 'adambard/master'
# Conflicts: # python.html.markdown
Diffstat (limited to 'bash.html.markdown')
-rw-r--r--bash.html.markdown8
1 files changed, 4 insertions, 4 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index 211d2944..bd2d5984 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -83,7 +83,7 @@ echo Hello, $Name!
# We have the usual if structure:
# use 'man test' for more info about conditionals
-if [ $Name -ne $USER ]
+if [ $Name != $USER ]
then
echo "Your name isn't your username"
else
@@ -91,12 +91,12 @@ else
fi
# NOTE: if $Name is empty, bash sees the above condition as:
-if [ -ne $USER ]
+if [ != $USER ]
# which is invalid syntax
# so the "safe" way to use potentially empty variables in bash is:
-if [ "$Name" -ne $USER ] ...
+if [ "$Name" != $USER ] ...
# which, when $Name is empty, is seen by bash as:
-if [ "" -ne $USER ] ...
+if [ "" != $USER ] ...
# which works as expected
# There is also conditional execution