summaryrefslogtreecommitdiffhomepage
path: root/bash.html.markdown
diff options
context:
space:
mode:
authorDarren Lin <dlin0915@gmail.com>2013-08-17 17:33:32 -0700
committerMax Yankov <golergka@gmail.com>2013-08-18 15:03:43 +0200
commita538c52fb444fc14782ceb8353f69da04d232e60 (patch)
tree96d6d9871d96bd7c1270c5b3ee2906a7cbfcc6e5 /bash.html.markdown
parent01f1419dd7d0fba8735cbafb4cff871e52604b07 (diff)
expanded the bash tutorial
Diffstat (limited to 'bash.html.markdown')
-rw-r--r--bash.html.markdown24
1 files changed, 22 insertions, 2 deletions
diff --git a/bash.html.markdown b/bash.html.markdown
index 1ddacc33..4e1eff9e 100644
--- a/bash.html.markdown
+++ b/bash.html.markdown
@@ -2,7 +2,7 @@
language: bash
contributors:
- - ["Max Yankov", "https://github.com/golergka"]
+ - ["Max Yankov", "https://github.com/golergka" - "Darren Lin", "https://github.com/CogBear"]
filename: LearnBash.sh
---
@@ -50,4 +50,24 @@ fi
# Expressions are denoted with the following format:
echo $(( 10 + 5 ))
-``` \ No newline at end of file
+# Commands can be substitued within other commands using $( ):
+# The following command displays the number of files and directories in the current directory.
+echo "There are $(ls | wc -l) items here."
+
+#Bash uses a case statement that works similarily to switch in Java and C++:
+case "$VARIABLE"
+in
+ #List patterns for the conditions you want to meet
+ 0) echo "There is a zero."
+ 1) echo "There is a one."
+ *) echo "It is not null."
+esac
+
+#For loops iterate for as many arguments given:
+#The contents of var $VARIABLE is printed three times.
+for $VARIABLE in x y z
+do
+ echo "$VARIABLE"
+done
+
+```