Concatenating strings in bash overwrites them

前端 未结 4 1743
长情又很酷
长情又很酷 2020-12-09 22:33

I\'m parsing query results from a mysql command (with the --table parameter)

local records=`echo \"${query}\" | $MYSQL -u $MyUSER -h $MyHOST -p$MyPASS --tabl         


        
4条回答
  •  无人及你
    2020-12-09 23:06

    Make sure you're using Bash 3 or later. The += operator in Bash can be used to manipulate an Array. It will use the current value of the IFS variable to split the tokens and add the value to the array.

    Try: test="$test $data" to concatenate the data

提交回复
热议问题