What I am trying to do :

I am trying to spawn a background process and redirect its output to VSC's shell. This background process should be independent from the parent shell, because VSC will wait until the shell that spawned it (the parent shell) sends an exit code.


echo "Starting webpack-dev-server"
cd .. && cd client && yarn debug


./startWebpack.sh &

What I am doing :

Following this guide I should be able to spawn a background process by appending a & after a script. It doesn't seem to make the script independent from the parent.

The parent shell seems to take over the output of the background process and never sends the exit signal. Killing the parent shell then also kills the background process.

Sending the output to /dev/null with ./startWebpack.sh > /dev/null did not make any difference. I could actually still see the output of that command.

VSC runs the command internally with bash -c ./startWebpack.sh & source. Not sure if that is affecting anything.

  • 1
    the > /dev/null redirects the output to /dev/null, but there are 3 files associated with any running task: input, output and error, which are file ids 0, 1 and 2. Input won't really be noticeable unless the script expects something from the user, but you need to deal with the error channel. The syntax noted in the answer below deals with both stdout and stderr with >/dev/null 2>&1, which tells the program to send output to /dev/null and error output (file 2) to wherever file1 is sending output.
    – Fubar
    Jun 9, 2020 at 15:43
  • 1
    Welcome to unix.stackexchange.com, and thank you for the clarity, sufficient context, and detail of your question. Jun 9, 2020 at 16:12

1 Answer 1


Use nohup e.g. nohup ./startWebpack.sh &> /dev/null &

that's the Bash syntax, for other shells you can nohup ./startWebpack.sh >/dev/null 2>&1 &

You can do that manually as well, e.g.

$ ./startWebpack.sh &
$ disown

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .