BASH: read every line in the files and use the line as parameters as another program

User Name

Remember Me?

Password

ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

The effect of double quotes in a.out "$REPLY" is to pass the entire line from file data as a single argument to a.out. If that is not what is required, remove the double quotes.

Regards "and then save the results of each calling of a.out into three variable", where do they appear and what is their format? Are they three whitespace-separated words on stdout? Anything on stderr? Exit status?

The variables v1 to v3 will not be set outside the loop because the "cat | while" pipeline results in bash running the while in a sub-shell. When the sub-shell terminates, variables set within it are lost.

I have tried this and it works, but as soon as I try to call a function from inside my reading loop it only every reads the first line.
The file it is reading in is formated like:
touch /tmp/t1
touch /tmp/t2
touch /tmp/t3

it runs fine. I checked my other functions and none of them are calling exit or anything and when I run it with bash -x, bash shows me that the second time it hits the while loop (aka after handling first line and reading in second) it exits. Anyone have any idea while it would be acting this way?