Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site rna.UUCP Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!cmcl2!rna!dan From: dan@rna.UUCP (Dan Ts'o) Newsgroups: net.unix Subject: Bourne shell programming question... Message-ID: <250@rna.UUCP> Date: Tue, 8-May-84 19:06:31 EDT Article-I.D.: rna.250 Posted: Tue May 8 19:06:31 1984 Date-Received: Sat, 12-May-84 10:47:06 EDT Organization: Rockefeller Neurobiology, NYC Lines: 38 Hi, I've just started to use the Bourne shell in non-trivial command script writing and have run into a number of problems. I am converting some shell scripts from an older shell (V6-like with variables). In particular, 1) How do you read a single line from /dev/tty (or an arbitrary file, NOT stdin) and assign that line to a variable ? 2) How do you arrange for a single instance of common shell code ? The Bourne shell has no procedures and no goto statement. For reading a single line into a variable from /dev/tty, I've had to use the ridiculous: a=`dd if=/dev/tty count=1 2>/dev/null` or a=`(read a echo $a) < /dev/tty` The read command doesn't seem to like its stdin re-directed (I know its a builtin command). There appears to a possibility of making /dev/tty the stdin by saying exec 0< /dev/tty but this throw away the old stdin. Even if these two problems have easy solution which I've overlooked, I'd like to say that the Bourne shell sucks. If people are accurate in saying the C-shell is worst than the Bourne shell for programming... I know the Korn shell has shell procedures and all its builtin commands are supposed to be I/O redirectable. Cheers, Dan Ts'o ...cmcl2!rna!dan