p=['sh','-c','ls -l | sort'].execute()
println p.text
This is mostly cross-platform (assuming CygWin) and is nicely succinct.
I like this method over using the Groovy Groosh module as suggested by Yuri Schimke if only because it doesn't require an import:
def f = gsh.find('.', '-name', '*.java', '-ls');
f.pipeTo(lines);
As always there are many ways to skin the same cat.
1 comment:
Thank you Sir!
Your code helped me out on an open source project.
The commit:
http://sourceforge.net/p/mlaw/code/ci/b5281b99a2ba7425f5826113f37d55de7de79884/
Post a Comment