Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active January 7, 2023 22:08
Show Gist options
  • Save vielhuber/702e897d5fa6c6b0afca32eb042e3bdd to your computer and use it in GitHub Desktop.
Save vielhuber/702e897d5fa6c6b0afca32eb042e3bdd to your computer and use it in GitHub Desktop.
linux / windows output suppress redirect to nirvana / stdout / stderr run in background 2>&1 #linux
# linux (no output)
bash script.sh > /dev/null 2>&1
# linux (no output & run in background)
bash script.sh > /dev/null 2>&1 &
# windows (no output)
echo foo 2> nul
# windows (run in background)
start /b bash script.sh
# unix & windows (no output)
echo foo >nul 2>&1
# unix (no output)
echo foo 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment