Added background commands
The syntax looks ugly, but this is the optimal way to do it. It doesn't have any extraneous output due to the parenthesis surrounding the command, and also sends error output to /dev/null.
This commit is contained in:
@@ -186,5 +186,16 @@ ls
|
||||
command ls
|
||||
```
|
||||
|
||||
<!-- CHAPTER END -->
|
||||
## Run a command in the background
|
||||
|
||||
This will run the given command and keep it running even after the terminal is closed.
|
||||
|
||||
```sh
|
||||
bkr() {
|
||||
(nohup "$@" &>/dev/null &)
|
||||
}
|
||||
|
||||
bkr ./some_script.sh # some_script.sh is now running in the background
|
||||
```
|
||||
|
||||
<!-- CHAPTER END -->
|
||||
|
||||
Reference in New Issue
Block a user