read

Jim:
read() is a system call not a unix command. e.g. If you write a
c-program involving read it would work.

p.s. If you can not run a command from your shell, then you cant run
     it in a shell script either!
--
Laxmi P. Musunur (LP) School of Forestry, Auburn University,
AUBURN AL 36849 E-mail: mlp@forestry.auburn.edu

----- Begin Included Message -----

I am writing a unix shell script which many prompts
involve echoing statements and reading answers. However,
when I run this program I get a read: Command not found.
Why is it not recognizing read? I thought this was a standard
unix command.

Jim

----- End Included Message -----

On Fri, 25 Mar 1994, Laxmi Prasad Musunur wrote:

Jim:
read() is a system call not a unix command. e.g. If you write a
c-program involving read it would work.

p.s. If you can not run a command from your shell, then you cant run
     it in a shell script either!

I just checked through about a half-dozen different references on the
Bourne shell, and every one of them included "read" as a built-in shell
command. There is a system call read(), of course, but that's not what Jim
meant. Also, the built-in shell command 'read' even works outside of a
shell script (e.g. on the usual interactive command line), although I've
never been able to think of any use to which I might want to put it
in that context.

Okay, it's time for a vote: Is anybody besides Jim confronted with a
vanilla Unix shell that doesn't understand read on the command line (we'll
assume that it'll be understood in a script in that case)? Just enter
something like

     read DUMMY

and type "Mark is one" on the next line. If 'read' is working, then you
should be able to enter

     echo $DUMMY

and get whatever you typed into 'read' back out of the variable again.

-- Mark

--------------------------------------------------------------------
Mark P. Line Phone: +1-206-733-6040
Open Pathways Fax: +1-206-733-6040
P.O. Box F Email: markline@henson.cc.wwu.edu
Bellingham, WA 98227-0296
--------------------------------------------------------------------

read() is a system call not a unix command

It is also a shell command that is interpretted by the /bin/sh interpretter.

If you can not run a command from your shell, then you cant run
it in a shell script either!

Not necessarily true - e.g. the above referenced read command.

Please be sure of your info before you pass it on and confuse others
with incorrect knowledge :slight_smile:

Run the following:

#!/bin/sh
echo enter a number
read a
echo $a

It works fine.

Jim: if you script isn't to big send it to me via private email (so as not
to waste bandwidth to the rest of the group). If it is rather large send
me about 10 line prior to the read and about 10 lines after your read. It
should work.

Let me know if you want some more help, (if you do lets try and do it
today - I have some slack time today but it is likely to quickly
disappear.

Pat McClanahan Internet:mcclanah@dlgeo.cr.usgs.gov
EROS Data Center mcclanah@edcserver1.cr.usgs.gov
Sioux Falls, SD
605-361-4607

read is a build-in command from the bourne shell. You have to be sure
to run your script using this shell (sh)

the first line should look like this:

#!/bin/sh

Ronald Wiemer