How to capture output from (!) ?
Posted: Tue Nov 02, 2004 11:01 pm
Is there an easy way to capture the stdout (and stderr) output
of an external command run using (!) without using files?
I'd like to be able to do something like:
(set 'file04 (! "ls -l | grep 2004"))
and have the result be the string spit out by
grep instead of the return code as (!) does now.
Perhaps the set of $ variables could be extended
to include a $stdout and $stderr such that after
running the above $stdout would contain the output
of grep and $stderr would be nil.
Another approach would be to redefine (!) to return
a list containing the result code, stdout, and stderr
as in:
(! "echo 'abc' ") --> ( 0 "abc" nil).
of an external command run using (!) without using files?
I'd like to be able to do something like:
(set 'file04 (! "ls -l | grep 2004"))
and have the result be the string spit out by
grep instead of the return code as (!) does now.
Perhaps the set of $ variables could be extended
to include a $stdout and $stderr such that after
running the above $stdout would contain the output
of grep and $stderr would be nil.
Another approach would be to redefine (!) to return
a list containing the result code, stdout, and stderr
as in:
(! "echo 'abc' ") --> ( 0 "abc" nil).