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!
You can use $@ and $* to refer to parameters.
echo "$@";
should do it. A little more information here
There is a variable called ac_configure_args that contains what I need. Thanks for the help everyone.
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.
精彩评论