Added another entry

This commit is contained in:
Dylan Araps 2018-06-15 16:03:05 +10:00
parent 1aea36ac90
commit 113686f557
1 changed files with 20 additions and 0 deletions

View File

@ -393,6 +393,8 @@ The Quick Brown
## Check if string contains a substring.
**Using a test:**
```shell
# Normal
if [[ "$var" == *sub_string* ]]; then
@ -410,6 +412,24 @@ if [[ "${arr[*]}" == *sub_string* ]]; then
fi
```
**Using a case statement:**
```shell
case "$var" in
*sub_string*)
# Do stuff
;;
*sub_string2*)
# Do more stuff
;;
*)
# Else
;;
esac
```
# Variables
## Assign and access a variable using a variable.