I'm trying to run some external command line program in Mathematica, and I have problem getting the output.
Import["!echo hello world\nexit\n", "Text"] (*"hello world"*)
run echo and get the output.
However this doesn't work for me
Import["!g++ -v", "Text"]
I only get an empty line.
In version 10, there is the
RunProcess function which seems to work
RunProcess[$SystemShell, "StandardError", "g++ -v exit "] (* Configured with: --prefix=/Library/Developer/CommandLineTools/usr \ --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.0.0 Thread model: posix *)
My question is, can we do the same thing in version 9, using other functions ?