bash: Move examples to the bottom
This commit is contained in:
parent
c8b99a83ff
commit
7813be2238
28
bash.md
28
bash.md
|
@ -389,18 +389,6 @@ Note that `[[` is actually a command/program that returns either `0` (true) or `
|
|||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
if ping -c 1 google.com; then
|
||||
echo "It appears you have a working internet connection"
|
||||
fi
|
||||
```
|
||||
|
||||
```bash
|
||||
if grep -q 'foo' ~/.bash_history; then
|
||||
echo "You appear to have typed 'foo' in the past"
|
||||
fi
|
||||
```
|
||||
|
||||
```bash
|
||||
# String
|
||||
if [[ -z "$string" ]]; then
|
||||
|
@ -749,6 +737,22 @@ cd -
|
|||
pwd # /home/user/foo
|
||||
```
|
||||
|
||||
### Check for command's result
|
||||
|
||||
```bash
|
||||
if ping -c 1 google.com; then
|
||||
echo "It appears you have a working internet connection"
|
||||
fi
|
||||
```
|
||||
|
||||
### Grep check
|
||||
|
||||
```bash
|
||||
if grep -q 'foo' ~/.bash_history; then
|
||||
echo "You appear to have typed 'foo' in the past"
|
||||
fi
|
||||
```
|
||||
|
||||
## Also see
|
||||
{: .-one-column}
|
||||
|
||||
|
|
Loading…
Reference in New Issue