I have a script that can be provided with [the potential] to have an unknown quantity of known arguments
That is, I know ALL the arguments that can be provided, but as they are all optional, they may not be getting provided all the time.
I have written this code (below), how can I send all the arguments provided to the 'setOptions' function? once they.are there I can iterate through them and process whats needed, but I don't have a clue how to pass them to the function.
Basically the case just checks to see if B or anything else is provided, if B then thats fine, but anything else needs to be iterated through and tested.
at the moment Im able to test if the value is a B or not and from there... well you can see.
# request statement
echo "Enter 'B' to build or the name of test you wish to run."
read testOptions
# check the options
case $testOptions in
B )
# tell them the tests are being rebuilt
echo " The test will be rebuilt"
COMMAND_LINE=$COMMAND_LINE" build"
# display the command to be used and execute it.
echo $COMMAND_LINE
$COMMAND_LINE
;;
* )
# we are not rebuilding, take all the options and send to processing
setOptions $testOptions #<- processes and builds the commandline from the arguments
# Execute the command
executeOptions $testOptions #<- executes the command line
;;
esac
read -a testOptions?sendOptions $testOptionsThen in the function sendOptions, I would useread -a $1and basically acase var in $1 .... iteration code... easc$inread: it takes zero or more variable names.