I have a script that launches certain nodes based on what arguments you enter
case "$1" in
start)
if [ "$2" == "puppet" ]; then
set_puppet_variables
check_ES_reqs
start
elif [ "$2" == "puppet1" ]; then
set_puppet1_variables
check_ES_reqs
start
elif [ "$2" == "master" ]; then
set_master_variables
check_ES_reqs
start
fi
if [ "$2" == "" ]; then
set_puppet_variables
check_ES_reqs
start
set_master_variables
check_ES_reqs
start
fi
I want to be able to launch multiple specific nodes for example when I type in command service ES start puppet puppet1 it will then launch only those two nodes.
Is there a way to format the $2 in my logic to accept $3, $4 depending on how many nodes I add? as there will be more. Like making the $2 to a $2* to accept the second argument and any others so I can launch multiple specific nodes.
Please help
Thank you
shiftcommand. There's a lot of replicated operation in each of those ifs.