1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-19 13:02:14 +02:00

Merge pull request #290 from avjinder/patch-1

The case statement in Bash is incorrect
This commit is contained in:
Adam Bard
2013-08-31 23:09:25 -07:00

View File

@@ -73,12 +73,11 @@ ls -l | grep "\.txt"
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
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."
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: