LinuxQuestions.org
Visit Jeremy's Blog.
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 (Chicago area)
Distribution: Red Hat (8.0, RHEL5,6), CentOS, SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64, MacOS, Raspian
Posts: 1,137

Rep: Reputation: 65
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: 9,493

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 12:06 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration