* Shell scripting under OSF1
@ 1998-02-06 5:00 Eric Le Donn�
1998-02-06 5:00 ` Mike Iglesias
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Eric Le Donn� @ 1998-02-06 5:00 UTC (permalink / raw)
I was told, and I would like confirmation, that a Bourne script such as the
following:
#!/bin/sh
ls | while read a
do
....
....
done
would fail because 'read ' in a pipe doesn't work on Dec Alpha...
Is it true ? False ? Does it depend on the version of the OS ?
Any clue would be greatly appreciated !
Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-06 5:00 Shell scripting under OSF1 Eric Le Donn�
@ 1998-02-06 5:00 ` Mike Iglesias
1998-02-09 5:00 ` Doug Hamilton
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Mike Iglesias @ 1998-02-06 5:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
In article <886783241.6919.0.nnrp-03.c246a7b2@news.demon.co.uk>,
Eric Le Donn� <eledonne@metrica.co.uk> wrote:
>I was told, and I would like confirmation, that a Bourne script such as the
>following:
>
>#!/bin/sh
>
>ls | while read a
>do
> ....
> ....
>done
>
>would fail because 'read ' in a pipe doesn't work on Dec Alpha...
It works for me on systems running 3.2c and 4.0B. Whoever told you
that was wrong...
--
Mike Iglesias Internet: iglesias@draco.acs.uci.edu
University of California, Irvine phone: (714) 824-6926
Office of Academic Computing FAX: (714) 824-2069
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-06 5:00 Shell scripting under OSF1 Eric Le Donn�
1998-02-06 5:00 ` Mike Iglesias
@ 1998-02-09 5:00 ` Doug Hamilton
1998-02-09 5:00 ` Kylan Coghlan
1998-02-09 5:00 ` Bob Vickers
3 siblings, 0 replies; 7+ messages in thread
From: Doug Hamilton @ 1998-02-09 5:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 495 bytes --]
I use it all the time, but I use ksh, not sh.
Doug
Eric Le Donn� wrote in message
<886783241.6919.0.nnrp-03.c246a7b2@news.demon.co.uk>...
>I was told, and I would like confirmation, that a Bourne script such as the
>following:
>
>#!/bin/sh
>
>ls | while read a
>do
> ....
> ....
>done
>
>would fail because 'read ' in a pipe doesn't work on Dec Alpha...
>
>Is it true ? False ? Does it depend on the version of the OS ?
>
>Any clue would be greatly appreciated !
>
> Eric
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-06 5:00 Shell scripting under OSF1 Eric Le Donn�
` (2 preceding siblings ...)
1998-02-09 5:00 ` Kylan Coghlan
@ 1998-02-09 5:00 ` Bob Vickers
3 siblings, 0 replies; 7+ messages in thread
From: Bob Vickers @ 1998-02-09 5:00 UTC (permalink / raw)
To: Eric Le Donné
Eric Le Donné wrote:
>
> I was told, and I would like confirmation, that a Bourne script such as the
> following:
>
> #!/bin/sh
>
> ls | while read a
> do
> ....
> ....
> done
>
> would fail because 'read ' in a pipe doesn't work on Dec Alpha...
>
> Is it true ? False ? Does it depend on the version of the OS ?
>
You may be thinking of something slightly different. The command
echo fred | read a ; echo $a
returns a null string under sh and bash, but returns 'fred' under ksh
[I'm using DU 4.0B]. This is because most Bourne shells run all pipes
as subprocesses.
Bob
--
======================================================================
Bob Vickers R.Vickers@dcs.rhbnc.ac.uk
Dept of Computer Science, Royal Holloway College, University of London
WWW: http://www.cs.rhbnc.ac.uk/home/bobv
Phone: +44 1784 443691
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-06 5:00 Shell scripting under OSF1 Eric Le Donn�
1998-02-06 5:00 ` Mike Iglesias
1998-02-09 5:00 ` Doug Hamilton
@ 1998-02-09 5:00 ` Kylan Coghlan
1998-02-12 5:00 ` Jim Seagraves
1998-02-09 5:00 ` Bob Vickers
3 siblings, 1 reply; 7+ messages in thread
From: Kylan Coghlan @ 1998-02-09 5:00 UTC (permalink / raw)
False - read works in a pipe-line. I use it all the time under ksh, just
tested under Bourne, works fine there as well. I have worked on 3.2c -
4.0c of DU, never had a problem.
Kylan
> #!/bin/sh
> ls | while read a
> would fail because 'read ' in a pipe doesn't work on Dec Alpha...
> Is it true ? False ? Does it depend on the version of the OS ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-09 5:00 ` Kylan Coghlan
@ 1998-02-12 5:00 ` Jim Seagraves
1998-02-13 5:00 ` Jerome FENAL
0 siblings, 1 reply; 7+ messages in thread
From: Jim Seagraves @ 1998-02-12 5:00 UTC (permalink / raw)
>
> > #!/bin/sh
> > ls | while read a
>
you could also write this as
for a in `ls`
do
action1 ; action2 ; ... actionn ;
done
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Shell scripting under OSF1
1998-02-12 5:00 ` Jim Seagraves
@ 1998-02-13 5:00 ` Jerome FENAL
0 siblings, 0 replies; 7+ messages in thread
From: Jerome FENAL @ 1998-02-13 5:00 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 142 bytes --]
And what about getting rid of ls (good with small dirs, but awful with
100+ files dirs) :
for a in *; do
action1$a
action2 $a
done
[-- Attachment #2: Card for Jerome Fenal --]
[-- Type: text/x-vcard, Size: 288 bytes --]
begin: vcard
fn: Jerome Fenal
n: Fenal;Jerome
org: Decylog (Admiral Computing p.l.c. France)
email;internet: jfenal@decylog.fr
title: Project Manager
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1998-02-13 5:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-02-06 5:00 Shell scripting under OSF1 Eric Le Donn�
1998-02-06 5:00 ` Mike Iglesias
1998-02-09 5:00 ` Doug Hamilton
1998-02-09 5:00 ` Kylan Coghlan
1998-02-12 5:00 ` Jim Seagraves
1998-02-13 5:00 ` Jerome FENAL
1998-02-09 5:00 ` Bob Vickers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox