diff options
author | Evgeniy Ginzburg <Nad.Oby@gmail.com> | 2014-08-06 23:45:44 +0300 |
---|---|---|
committer | Evgeniy Ginzburg <Nad.Oby@gmail.com> | 2014-08-06 23:45:44 +0300 |
commit | cb3217fc35f3097c4be5b39fb36bd74b5e415f6c (patch) | |
tree | cedbb3d549ea8f810ab720b09f1c56ba6b89dc6e /bash.html.markdown | |
parent | 7bcf65278c28cffd32ef051965c2e6401563acc9 (diff) | |
parent | 4349587ac4de7bc3436f68415bcf5bdfac260e5e (diff) |
Merge https://github.com/adambard/learnxinyminutes-docs
Added two minor changes in integer division to make it clear
Diffstat (limited to 'bash.html.markdown')
-rw-r--r-- | bash.html.markdown | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bash.html.markdown b/bash.html.markdown index 15d1c068..845ebead 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -7,6 +7,7 @@ contributors: - ["Alexandre Medeiros", "http://alemedeiros.sdf.org"] - ["Denis Arh", "https://github.com/darh"] - ["akirahirose", "https://twitter.com/akirahirose"] + - ["Anton Strömkvist", "http://lutic.org/"] filename: LearnBash.sh --- @@ -81,6 +82,17 @@ fi echo "Always executed" || echo "Only executed if first command fails" echo "Always executed" && echo "Only executed if first command does NOT fail" +# To use && and || with if statements, you need multiple pairs of square brackets: +if [ $NAME == "Steve" ] && [ $AGE -eq 15 ] +then + echo "This will run if $NAME is Steve AND $AGE is 15." +fi + +if [ $NAME == "Daniya" ] || [ $NAME == "Zach" ] +then + echo "This will run if $NAME is Daniya OR Zach." +fi + # Expressions are denoted with the following format: echo $(( 10 + 5 )) |