port=$(ssh tms6@$x cat /tms6/scripts/start.lc.sh | grep -P '^\/tms6\/bin\/lc' | cut -d' ' -f3 | cut -b 3-6)
tpsip=$(ssh tms6@$x cat /tms6/scripts/start.lc.sh | grep -P '^\/tms6\/bin\/lc' | cut -d' ' -f4 | cut -b 9-)
# IFS="\n"
set -- $port
set -- $tpsip
# Converting the string to array
port_arr=( $port )
tpsip_arr=( $tpsip )
port_num=${#port_arr[@]}
tpsip_num=${#tpsip_arr[@]}
for (( i = 0; i <= $tpsip_num; i++ )) ### Outer for loop ###
do
for (( j = $i; j <= $port_num; j++ )) ### Inner for loop ###
do
# echo -n "${tpsip_arr[$i]} ${port_arr[$j]}"
$MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -D test -Bse 'INSERT INTO LC (server_ip, lc_used_ip, lc_used_port) VALUES ("${BOOT}", "${tpsip_arr[$i]}", "${port_arr[$j]}")'
break
done
echo "" #### print the new line ###
done
variable marked in red are not interpolating as getting those value in LC table under database 'test' is exactly the same as they appear here.
Plz suggest ny workaround..........