13
README.md
13
README.md
@@ -152,6 +152,7 @@ See something that is incorrectly described, buggy or outright wrong? Open an is
|
|||||||
* [Get the list of functions in a script](#get-the-list-of-functions-in-a-script)
|
* [Get the list of functions in a script](#get-the-list-of-functions-in-a-script)
|
||||||
* [Bypass shell aliases](#bypass-shell-aliases)
|
* [Bypass shell aliases](#bypass-shell-aliases)
|
||||||
* [Bypass shell functions](#bypass-shell-functions)
|
* [Bypass shell functions](#bypass-shell-functions)
|
||||||
|
* [Run a command in the background](#run-a-command-in-the-background)
|
||||||
* [AFTERWORD](#afterword)
|
* [AFTERWORD](#afterword)
|
||||||
|
|
||||||
<!-- vim-markdown-toc -->
|
<!-- vim-markdown-toc -->
|
||||||
@@ -1978,6 +1979,18 @@ ls
|
|||||||
command ls
|
command ls
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Run a command in the background
|
||||||
|
|
||||||
|
This will run the given command and keep it running, even after the terminal or SSH connection is terminated. All output is ignored.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bkr() {
|
||||||
|
(nohup "$@" &>/dev/null &)
|
||||||
|
}
|
||||||
|
|
||||||
|
bkr ./some_script.sh # some_script.sh is now running in the background
|
||||||
|
```
|
||||||
|
|
||||||
<!-- CHAPTER END -->
|
<!-- CHAPTER END -->
|
||||||
|
|
||||||
# AFTERWORD
|
# AFTERWORD
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ if [[ "$var" == *sub_string ]]; then
|
|||||||
printf '%s\n' "var ends with sub_string."
|
printf '%s\n' "var ends with sub_string."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Inverse (var does not start with sub_string).
|
# Inverse (var does not end with sub_string).
|
||||||
if [[ "$var" != *sub_string ]]; then
|
if [[ "$var" != *sub_string ]]; then
|
||||||
printf '%s\n' "var does not end with sub_string."
|
printf '%s\n' "var does not end with sub_string."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
| Expression | What does it do? |
|
| Expression | What does it do? |
|
||||||
| ---------- | ---------------- |
|
| ---------- | ---------------- |
|
||||||
| `file -ef file2` | If both files refer to the same inode and device numbers.
|
| `file -ef file2` | If both files refer to the same inode and device numbers.
|
||||||
| `file -nt file2` | If `file` is newer than `file2` (*uses modification ime*) or `file` exists and `file2` does not.
|
| `file -nt file2` | If `file` is newer than `file2` (*uses modification time*) or `file` exists and `file2` does not.
|
||||||
| `file -ot file2` | If `file` is older than `file2` (*uses modification ime*) or `file2` exists and `file` does not.
|
| `file -ot file2` | If `file` is older than `file2` (*uses modification time*) or `file2` exists and `file` does not.
|
||||||
|
|
||||||
## Variable Conditionals
|
## Variable Conditionals
|
||||||
|
|
||||||
|
|||||||
@@ -186,5 +186,17 @@ ls
|
|||||||
command ls
|
command ls
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Run a command in the background
|
||||||
|
|
||||||
|
This will run the given command and keep it running, even after the terminal or SSH connection is terminated. All output is ignored.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bkr() {
|
||||||
|
(nohup "$@" &>/dev/null &)
|
||||||
|
}
|
||||||
|
|
||||||
|
bkr ./some_script.sh # some_script.sh is now running in the background
|
||||||
|
```
|
||||||
|
|
||||||
<!-- CHAPTER END -->
|
<!-- CHAPTER END -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user