diff options
| author | Mark Green <mark@antelope.nildram.co.uk> | 2016-01-22 00:54:49 +0000 | 
|---|---|---|
| committer | Mark Green <mark@antelope.nildram.co.uk> | 2016-01-22 00:54:49 +0000 | 
| commit | 57053bc95d4166a42da8f6d1732dd21a217b073a (patch) | |
| tree | 293a7775d4b46313a2ee955691141095653d4044 /bash.html.markdown | |
| parent | def04721be506f1c7ff5ddf407f2333999570a89 (diff) | |
| parent | 9a5bb286686f5dd4fb743c1bd15ad70a3c6a4a3f (diff) | |
Merge remote-tracking branch 'refs/remotes/adambard/master'
Diffstat (limited to 'bash.html.markdown')
| -rw-r--r-- | bash.html.markdown | 8 | 
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  | 
