Technical article 106080

How do I read in a line with the C shell? Using "$<" does not work.

OpenServer 5.0.0

Written · Last revised

Problem

I have a C shell script that uses the "$<" syntax to read an
input line from the user.  However, when I run the script I
get this error message from the shell:
Variable syntax.

Cause

The "$<" syntax is not supported in SCO releases of the C shell.

Solution

The line(C) command may be used instead to read the input
line.  For example, if the original shell script is:
echo "Please enter your string \c"
set string = $<
echo "Your string is $string"
this should be changed to:
echo "Please enter your string \c"
set string = `line`
echo "Your string is $string"

From the Xinuos technical article database, record 106080. Reproduced with permission. The original is at www.sco.com/ta/106080, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.