[IPython-dev] Re: [IPython-user] Commits to CVS, fixes, and shell access (RFC)
Fernando.Perez at colorado.edu
Thu Apr 1 15:13:20 EST 2004
> This sounds great--similar to what I did for my "grep" shell access,
> but generalized. (I didn't look into storing the results in "hidden"
> variables, but that looks like a good idea also.)
Indeed, your grep (with the caveats below) would now just be one more case of:
!!grep regexp files
!!grep assert *.py
would work, since all wildcards propagate down directly to the shell.
> I'm having troubles accessing the CVS repository from here, so I
> won't be able to give usage feedback until after this weekend
> at the soonest.
> I've a question though. My grep shell extension would capture
> stdout and stderr separately, and wouldn't return stderr, but
> just printed it. It would then return whatever the command
> *had* sent to stdout (or None if nothing). What does @sc do
> for this?
I was lazy and just used commands.getoutput(), which lumps them together. But
what you are doing is the right thing, IMO. I'll recode it later and
recommit to CVS, so that both @sc and @sx function as follows:
- stdout is captured, either to the named var for @sc or to the normal ipython
return value for @sx.
- stderr, if present, is just printed to the screen.
How does this sound?
Thanks for the feedback.
More information about the IPython-dev