Skip to content

Instantly share code, notes, and snippets.

@peterver
Last active November 12, 2017 14:05
Show Gist options
  • Save peterver/c1dcd3eeeb720cae1428256e3278db1f to your computer and use it in GitHub Desktop.
Save peterver/c1dcd3eeeb720cae1428256e3278db1f to your computer and use it in GitHub Desktop.
Supress all output but still retrieve the exit code of a command
#!/bin/bash
rep=$(...INSERT_COMMAND_HERE... 2>&1 >/dev/null)
status=$?
echo "$status"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment