Skip to content

Instantly share code, notes, and snippets.

@florian
Created November 15, 2012 19:23
Show Gist options
  • Save florian/4080618 to your computer and use it in GitHub Desktop.
Save florian/4080618 to your computer and use it in GitHub Desktop.
Execute a bash command without output
# OK, so I'm terrible at bash and the code below might be terrible, too, but it does the work for me. :3
function silent {
echo $* | sh >/dev/null 2>&1
}
# Usage:
silent echo hai world
silent make server
# BTW: Only the first command passed to the function will be silented.
silent echo a; echo b; echo c # Will output: b\nc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment