misc: cleanup

This commit is contained in:
Dylan Araps 2018-06-19 12:56:55 +10:00
parent 24adf2b53d
commit 81fb35d0ec
1 changed files with 18 additions and 17 deletions

View File

@ -453,6 +453,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
```
## Check if string starts with sub-string.
```shell
@ -479,23 +497,6 @@ if [[ "$var" != *sub_string ]]; then
fi
```
**Using a case statement:**
```shell
case "$var" in
*sub_string*)
# Do stuff
;;
*sub_string2*)
# Do more stuff
;;
*)
# Else
;;
esac
```
# Arrays