LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-29-2011, 07:53 PM   #1
Tyediem
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Input Redirection for multiple arguments


I wish to run a function with an arbitrary number of arguments with input from the lines of a text file. I assume the use of a for loop is needed, but am finding trouble using this to pass in more than one argument. Any aid would be appreciated.
 
Old 09-29-2011, 09:27 PM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,801

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by Tyediem View Post
I wish to run a function with an arbitrary number of arguments with input from the lines of a text file. I assume the use of a for loop is needed, but am finding trouble using this to pass in more than one argument. Any aid would be appreciated.
You mean something like:
Code:
cat filename | while read REC
do
   set ${REC}
   while [ $# -gt 0 ]
   do
      do-something with $0
      shift
   done
done
Your problem description wasn't terribly explicit. Maybe if you can provide a bit more background on what you're trying to do.

--
Rick
 
Old 09-29-2011, 10:05 PM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Quote:
pass in more than one argument
To what or where?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Passing input arguments by reference in C. stf92 Programming 4 08-19-2011 08:24 PM
Input Redirection Hi_This_is_Dev Programming 2 04-27-2010 02:25 AM
help with input output redirection Hard_Working_ Programming 2 05-07-2007 11:11 AM
Implementing Input Redirection amitbern Programming 3 11-06-2006 12:04 PM
Output & input redirection serotonincy Programming 3 04-12-2004 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration