[comp.unix.shell] how to use the -t option in csh

coleman@cam.nist.gov (Sean Sheridan Coleman X5672) (12/10/90)

What is the purpose of the -t option in csh and 
how does one use it. I tryed to use it  doing the
following:

/bin/csh -t "ps ax; cat ~/.login"

It just sat there until I enterd a return the second time.

I have SunOS 4.1

Thanks

Sean Coleman
NIST
Boulder, CO 

coleman@bldrdoc.gov

jik@athena.mit.edu (Jonathan I. Kamens) (12/10/90)

In article <6145@alpha.cam.nist.gov>, coleman@cam.nist.gov (Sean Sheridan Coleman X5672) writes:
|> What is the purpose of the -t option in csh and 
|> how does one use it. I tryed to use it  doing the
|> following:
|> 
|> /bin/csh -t "ps ax; cat ~/.login"
|> 
|> It just sat there until I enterd a return the second time.

My csh(1) (BSD 4.3) says:

     -t   A single line of input is read and executed.  A `\' may
          be used to escape the newline at the end of this line
          and continue onto another line.

Note that the input is read *from the standard input*, not from the command
line; you appear to be attempting to use the option as if the input is read
from the command line.  For that, I believe what you want to use is the -c
option, not the -t option.  Again, from my man page:

     -c   Commands are read from the (single) following argument
          which must be present.  Any remaining arguments are
          placed in argv.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

guy@auspex.auspex.com (Guy Harris) (12/15/90)

>What is the purpose of the -t option in csh and 
>how does one use it.

Mr. Kamens' explanation of how to use it, and why you probably don't
want to use it, is correct.

I assume the purpose for it is the same as the purpose for "-t" flags in
other shells, dating back to the V6 shell, which is that it's there for
the benefit of "ed"'s "!" command.

The V6 "ed" used "read()" to read its command line one character at a
time.  If it discovered that the character was a "!", as I remember it
would then fire off a shell with the "-t" flag, and that shell would
then read the rest of the line.  I forget whether the original V6 shell
(we're talking V6, an OS that came out in 1975, folks...) even had a
"-c" flag.

I don't think many programs bother using the "-t" flag any more; they
tend to use "-c" instead.