How to pass different number of arguments in a single shot

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

below script will ignore # and blank space

#! /bin/bash
val=`awk '$0 !~ /^[#]|[\ ]/{
i=0
printf("%s ",$0)
}' inp4`
./te5 $val
echo $val

if you want add any other pattern apart from # and blank space you can update this line in the script

awk '$0 !~ /^[#]|[\ ]/{

Thanks
Kalai

1 Like

Why not let the shell script parse the configuration file?

@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?

Shell scripts can read shell scripts natively.

. configurationfile

No parsing, no nonsense with eval, it just reads it, and it just works.