On Tue, 4 Feb 2003 at 11:53pm (-0700), [EMAIL PROTECTED] wrote: > OK, I SURE Ive done this before, but I cant quite get the > syntax right on this shell script. > > What I WANT to do is read lines from a list of data, and > pass the lines (individually) to another script. > > What Im trying (and I get syntax complaints) is > > test.sh < test.data > > where test.sh is > > #!/bin/sh > > while ( ! read line ) > do > echo $line > done > > needless to say the 'echo' will be replaced with something more substantial > when I can get this to work... > > SO, this doesnt, work, how should it REALLY read????
You've got your read in a subshell which isn't cool 'cause while the read will work the echo is outside the the subshell so $line won't have anything useful in it. Also your ! reverse the sence of the read so the loop finsih whenever any input is received. Just... while read line do echo $line done ... should be what you want. -- WebCentral Pty Ltd Australia's #1 Internet Web Hosting Company Level 5, 100 Wickham St. Network Operations - Systems Engineer PO Box 930, Fortitude Valley. phone: +61 7 3249 2552 Queensland, Australia 4006. pgp key id: 0x900E515F -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list