mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-12 17:54:26 +02:00
Update bash.html.markdown
In the case statement, the "in" keyword should be on the same line as case $VARIABLE. Also, ;; should be present at the end of each command. Shell executes all statements up to the two semicolons that are next to each other.
This commit is contained in:
@@ -73,12 +73,11 @@ ls -l | grep "\.txt"
|
|||||||
echo "There are $(ls | wc -l) items here."
|
echo "There are $(ls | wc -l) items here."
|
||||||
|
|
||||||
# Bash uses a case statement that works similarily to switch in Java and C++:
|
# Bash uses a case statement that works similarily to switch in Java and C++:
|
||||||
case "$VARIABLE"
|
case "$VARIABLE" in
|
||||||
in
|
|
||||||
#List patterns for the conditions you want to meet
|
#List patterns for the conditions you want to meet
|
||||||
0) echo "There is a zero."
|
0) echo "There is a zero.";;
|
||||||
1) echo "There is a one."
|
1) echo "There is a one.";;
|
||||||
*) echo "It is not null."
|
*) echo "It is not null.";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#For loops iterate for as many arguments given:
|
#For loops iterate for as many arguments given:
|
||||||
|
Reference in New Issue
Block a user