I have defined a variable as list where i want to add the result derived from sql. My shell script looks like the below-
list=""
setLiveTables()
{
liveTablesList=`"SELECT CalculatorName FROM TableList"`
if echo "$liveTablesList"; then
echo "${liveTablesList}" | while read line
do
trimLine=`echo $line | sed 's/ *$//g'`
listCalc+=""${trimLine}","
done
list=$listCalc
}
doSomething()
{
setLiveTables
# Do some curl call with data $list
# Here list appears empty
}
doSomething
in doSomething function i get value of list always empty wven whe i get response from sql. If i Log listCalc inside setLiveTables, i do get the data in it.