Re: Getting user input

From: Chris Mattern (
Date: 08/19/03

Date: Tue, 19 Aug 2003 16:33:24 -0400

Taka wrote:
> On Wed, 09 Jul 2003 18:29:31 +0000, Kenny McCormack wrote:
>>In article <UVSOa.749$>,
>>John <replyto@newsgroup.please> wrote:
>>>Apologies for the stupid question,
>>>In csh, how do I get a script to wait for user input and then assign
>>>that input to a variable when retun is pressed ?
>>>Something similar to 'read' in ksh would be great
>>set var=`ksh -c 'read line;echo $line'`
> lol

You can laugh, but it's actually the best way to do it.
&< reads from your tty, not your stdin. *You can't
redirect it.* There is no way to ask csh to read from

                  Chris Mattern

Relevant Pages

  • Re: looking for thread about backup using ssh -T
    ... If stdin is not a tty, ... allocation, and that only happens if stdin is a tty. ... incantation because it has less opportunity to seem magic or be treated ...
  • Re: tty question
    ... no access to tty. ... stty: stdin isn't a terminal ... This differs from having a connection to a pseudo tty ... which is connected to the standard input and standard output in that you ...
  • Re: detect batch mode in Tcl shell
    ... seems to correspond ro what tcl_interactive reports. ... stdin is a TTY. ... the real equivalent to that check ... will look different if the terminal is a TTY. ...
  • Re: /dev/stdin .... ?
    ... > with OpenSSH's SFTP program to transfer files among hosts. ... /proc/self/0 is not going to always be linked to the tty. ... to fix sftp to do what most portable programs do... ... as a special case for stdin... ...
  • Re: Problem with popen() under FreeBSD v5.2.1 (long post)
    ... so this version works because the command's stdout becomes the main ... >tty if you run it interactively w/o redirection. ... > - read a line from stdin ...