Skip to content

Instantly share code, notes, and snippets.

@ThabetAmer
Created April 8, 2020 08:34
Show Gist options
  • Save ThabetAmer/d2dfa76491ae53b706ab14dd6e41a3f0 to your computer and use it in GitHub Desktop.
Save ThabetAmer/d2dfa76491ae53b706ab14dd6e41a3f0 to your computer and use it in GitHub Desktop.
Runs shell command and prints back stdout and stderr
#!/usr/bin/env groovy
/*
* Runs shell command and prints back stdout and stderr
*/
command='ls -al'
println new ProcessBuilder('sh','-c',command).redirectErrorStream(true).start().text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment