Select command is showing options without displaying question.
It is displaying question after a choice is made.
I have a function as shown below in a script.
function start_AppNode
{
# Define local variables for all the inputs
local DName_l=$1
local ASName_l=$2
local ANName_l=$3
echo "Do you wish to start the AppNode $ANName_l on AppSpace $ASName_l in Domain $DName_l ?"
select yn in "Yes" "No"; do
case $yn in
Yes )
#print_log $yn
OUTPUT="
Update:
The issue is due to variable assignment. I am assigning the output of the function to a variable. If I execute the function without assigning the return value to a variable, it works. How can I assign the return value to a variable and still have the question part displayed before the options?
./appadmin start -d $DName_l -as $ASName_l anode $ANName_l
"
if [[ "$OUTPUT" == *"$SuccessMessage_AppNode_Start"* ]]; then
echo "Started"
else
echo "Failed"
fi
break;;
No ) echo "Failed"; break;;
esac
done
}
When I call that script in an other script where I imported this script, I am getting option first and not showing the question "Do you wish to start the AppNode $ANName_l on AppSpace $ASName_l in Domain $DName_l ?
"
It shows the question after a choice is being made. See screenshot of output below. Appreciate if anyone can help me understand how to make it show the question first?

Asked by Anil_4_Tibco_Java
(3 rep)
Dec 6, 2021, 05:20 PM
Last activity: Dec 6, 2021, 09:24 PM
Last activity: Dec 6, 2021, 09:24 PM