tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* ksh command grouping and file-descriptors
@ 1998-07-02 15:49 Serge MUNHOVEN
  0 siblings, 0 replies; only message in thread
From: Serge MUNHOVEN @ 1998-07-02 15:49 UTC (permalink / raw)
  To: tru64-unix-managers

Dear Digital UNIX gurus,

While modifying a script for POSIX-sh, which happens to be ksh, I
came accros a problem which melts down to what is reported below (sorry for
the lengthy output).

Note that:
 - POSIX/ksh was initially required for some features not available in sh;
 - command grouping (...) is required because the actual script is more
   evolved than a simple while-do loop;
 - the current version now runs under plain sh, so there is no longer a
   problem for me.

I'd just like to know if this is "a bug or a feature", or just bad shell
syntax on my account ...

% cat readabc
echo "=== ... << ==="
while read A B C; do echo $A $B $C; done <<EOF
a b c
x y z
EOF
#
echo "=== ... 9<< ==="
while read A B C <&9 ; do echo $A $B $C; done 9<<EOF
a b c
x y z
EOF
#
echo "=== (...) << ==="
(while read A B C; do echo $A $B $C; done) <<EOF
a b c
x y z
EOF
#
echo "=== (...) 9<< ==="
(while read A B C <&9 ; do echo $A $B $C; done) 9<<EOF
a b c
x y z
EOF
#
echo "===EOF==="
%
% sh readabc
=== ... << ===
a b c
x y z
=== ... 9<< ===
a b c
x y z
=== (...) << ===
a b c
x y z
=== (...) 9<< ===
a b c
x y z
===EOF===
%
% ksh readabc
=== ... << ===
a b c
x y z
=== ... 9<< ===
a b c
x y z
=== (...) << ===
a b c
x y z
=== (...) 9<< ===
a b c
===EOF===
$ 

Oops, where did the second line (and following ones if there were) go ?
With more evolved input and from a file rather than a here-document, I get
even stranger output.

OS: Digital UNIX 4.0D + most of jumbo patch #1

Thanks in advance for any comments,

 - Serge

-- 
-                                                                             -
 Serge Munhoven                              Internet: munhoven@mema.ucl.ac.be
 Universite Catholique de Louvain               Phone (office): ++32-10-478032
 CESAME - Applied Mechanics Division                (division): ++32-10-472350
 Av. Georges Lemaitre, 4                                   Fax: ++32-10-472180
 B-1348 Louvain-la-Neuve (Belgium - Europe)                      Office: a.011
-                                                                             -

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-07-02 15:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-07-02 15:49 ksh command grouping and file-descriptors Serge MUNHOVEN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox