views:

40

answers:

3

Hi,

I'm trying to print arguments passed to a ./configure script. Calling 'echo' on $BASH_ARGV will just print the last set of arguments. For example if I run:

./configure --enable-foo --enable-bar

echo $BASH_ARGV will print only "--enable-bar"

How do I print all the arguments? Thanks!

A: 

You can use $@ and $* to refer to parameters.

echo "$@"; should do it. A little more information here

Decio Lira
This doesn't seem to work. Echoing $@ will just output 'dummy make'
Sam
are you using the double quotes?
Decio Lira
yes i used the double quotes
Sam
In this case, quotes aren't needed.
Dennis Williamson
it is usefull if the parameters have blanks. But this doesn't seem the case.
Decio Lira
A: 

Since it's an array, you need to do this to get all the elements:

echo ${BASH_ARGV[@]}

or use a loop to iterate over them.

Note: they'll be output in reverse order.

Dennis Williamson
+1  A: 

There is a variable called ac_configure_args that contains what I need. Thanks for the help everyone.

Sam