Re: RFA: >, >>, and "tee" operators

Daniel Jacobowitz
2002-07-25T03:10:22Z

On Wed, Jul 24, 2002 at 10:01:03PM -0400, Andrew Cagney wrote:
> >On Tue, Jul 23, 2002 at 02:24:15PM -0600, Tom Tromey wrote:
> >
> >>>>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
> >
> >>
> >
> >>>> transcript > FILE
> >>>> transcript >> FILE
> >>>> transcript | COMMAND
> >
> >>
> >>Daniel> I don't like this syntax very much. It looks too much like
> >>Daniel> dumping the output of a command ("transcript") to the file,
> >>Daniel> not like a redirection for the future output.
> >>
> >>Good point.
> >>
> >>Daniel> Also - is piping to a command actually useful?
> >>
> >>I don't know. I haven't even been running with this patch in place,
> >>since the feature in general is only occasionally useful to me. I
> >>thought I saw a request for this (piping to a command)?
> >>
> >>Daniel> Hmm... How do you feel about:
> >>Daniel> transcript [-append] FILE
> >>Daniel> tee [-append] FILE
> >>Daniel> Where transcript replaces ">" and ">>"?
> >>
> >>That looks good to me. Or even `transcript [-tee] [-append] FILE'.
> >>Or maybe `[-notee]', with tee as the default.
> >
> >
> >I'd rather have tee as the default, also. But -notee doesn't look
> >right, so I left it as two commands. Anyone else out on the list have
> >a suggestion?
>
> Does the `transcript FILE' command send both the user input (prompts?)
> and output to the file (output also to the console)? Like unix script?

[Speaking for my patch]

Nope. Prompts and user input are not logged. Output goes only to a
file. Something like `script' might be useful but that's a patch for
another day.

> I guess the corresponding ``tee FILE'' command just writes output?

Output goes to the file and to the normal output channel. Still no
prompts or input.

> I think there is also a need for a tempoary redirection. So I guess
> either the obscure:
> >FILE <command> ...
> maybe?
> log FILE <command> .....

How about "transcript FILE <command>"? There's some quoting badness but
for the moment I'm willing to just disallow spaces in the filename.
Much more straightforward that way.

That doesn't allow for:
transcript | command args <gdbcommand>
but that's also an OK restriction, I think...

> GDB's option identifier is ``/'' and not ``-''. See the print/<FMT>
> commands. ``-'' has the problem of being a valid expression operator.
> I should note that the current parser is pretty broken. It can't
> differentiate between:
> transcript/f
> transcript /f
> (sigh) but that is a fixable problem.

GDB's option identifier varies, actually; symbol-file -readnow,
add-symbol-file -s are the only two I see offhand.
We only use / for print format characters. Mostly we just drop them
all on one line.

I'd rather stick with '-' as it's more familiar to most of our
audience, particularly with 'tee -a'.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer