Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2006 07:10:16 -0800 (PST)
From:      Angelo Christou <christou44@yahoo.com>
To:        freebsd-questions@freebsd.org
Subject:   Shell Script Help
Message-ID:  <20060129151016.96211.qmail@web37109.mail.mud.yahoo.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060129151016.96211.qmail>