Shell Script Help

Angelo Christou christou44 at yahoo.com
Sun Jan 29 07:10:18 PST 2006


Hello, I am running FreeBSD 6.0 with Bash as my shell. I am trying to automate a task and I have been reading a lot about Bash, but I haven't been able to get a script working.

I have a program that I need to pass 3 variables. I have a text file called list.txt that has the variables separated by a space. There are hundreds of lines which is why I am trying to automate this. I'd like to learn shell too :)

list.txt contains:

bob home 9002
jim data 9005
sarah backup 4001
john temp 3001
 
(it's in the format var1 var2 var3)

Running the following for each line is what I'm trying to do:
myprogram bob home 9002
myprogram jim data 9005
and so on......

I need to pass the variables in list.txt to my program. From the docs on shell scripting I have been reading, I think I need to run something like this:

# for (not sure what to put here) in list.txt;do myprogram $1 $2 $3;done

Perhaps some experienced users might know how to do this? I am not even sure if I'm doing this the right way or if it can be done.

Thank you very much for any help you can provide.
Ang



		
---------------------------------
Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.


More information about the freebsd-questions mailing list