I have one configuration file. The number of lines in the file will vary. I need to pass each line as a parameter to a shell script in a single shot.
Ex:
Suppose file contains:
ou=x,o=z
o=y
Suppose the shell script name is sample.sh. Then the script should be called like sample.sh ou=x.o=z o=y
Like said previously no of lines in the file will vary. I know how to read line by line pass each line to shell script. But here I need to pass all the arguments in one shot. Will argList = $argList + "$line" will suffice?
Hi kalpeer,
Thanks for your reply. Actually the file may contain some line starting with #. Those lines we need to ignore. Also we need to ignore if there are any blank lines. So I think that time this method will not work.
Ex:
samplefile
#This is a sample file #Only for examples
ou=x,o=n
ou=a,ou=b,o=c
o=n
So, now we need to pass 3 arguments like this:
sample.sh ou=x,o=n ou=a,ou=b,o=c o=n
@kalpeer, thanks a lot dude. Can you please clarify how it works? It will be helpful for me in later contexts as I am new to linux shell script area.Also I need to replace dot in any line by a comma. Sorry for bugging you :(. Going mad
@fpmurphy: Didn't get you. Can you please calrify?