From ff4b3db9cbdc15b3d3ffc854be867d88e4cff0da Mon Sep 17 00:00:00 2001 From: CoolOppo Date: Wed, 27 Jun 2018 21:39:04 -0400 Subject: [PATCH] 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. --- manuscript/chapter19.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/manuscript/chapter19.txt b/manuscript/chapter19.txt index f575993..c903ef0 100644 --- a/manuscript/chapter19.txt +++ b/manuscript/chapter19.txt @@ -186,5 +186,16 @@ ls command ls ``` - +## 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 +``` + +