read from a file in bourne shell
Jeffrey Youngstrom
jeffy at teda.UUCP
Wed Feb 20 09:35:22 AEST 1991
I want to set some variables in a Bourne shell script from the contents
of a file while still being able to prompt a real time user for input.
The file looks like this:
1
0
foo
8
2
(i.e. one word per line)
Things I've tried:
spawning a subshell and redirecting its input from the file.
But variables not available outside the subshell, and can't
get user input from inside the subshell.
hokey kludges using "for var in `cat file`" and/or awk
But ugly. (so to speak... :-)
Is there a good way to set variables from file contents in Bourne?
As far as I can tell, Bourne doesn't support arrays?
Please send email. I'll summarize for interested parties (email me)
Thanks,
jeffy
--
Jeffrey Youngstrom ...!{decwrl,sun}!teda!jeffy or jeffy at altair.csustan.edu
Teradyne EDA West | 5155 Old Ironsides Drive | Santa Clara, CA 95054
I have no idea what I'm doing out of bed.
More information about the Comp.unix.shell
mailing list