When I assign a variable containing double quotes to another variable the double quotes (") sometimes get converted to single quotes ('). .can you please suggest how to solve this.
TASK [asm_pdb_disk_mapping : debug] ************************************************************************************************************************************
ok: [10.0.0.10] => {
“device_name”: {
“changed”: true,
“cmd”: “a1=( "xvda" "xvdb" "xvdc" "xvdd" "xvde" "xvdf" "xvdg" "xvdh" "xvdi" "xvdj" "xvdk" "xvdl" "xvdm" "xvdn" "xvdo" "xvdp" "xvdq" "xvdr" "xvds" "xvdt" "xvdu" "xvdv" "xvdw" "xvdx" "xvdy" "xvdz")\nfor i in cat /tmp/volume.txt | sed -e 's/\\[//' | sed -e 's/\\]//' | sed -e 's/\\\"//g' | sed -e 's/,/ /g'
\ndo\na2+=("$i")\ndone\na3=()\nfor i in "${a1[@]}"; do\nskip=\nfor j in "${a2[@]}"; do\n [[ $i == $j ]] && { skip=1; break; }\ndone\n [[ -n $skip ]] || a3+=("$i")\ndone\njoined=$(printf ","\""dev/"%s"\"" "${a3[@]:0:2}") \necho "["${joined:1}"]"\n”,
“delta”: “0:00:00.088902”,
“end”: “2020-02-17 21:50:56.868731”,
“failed”: false,
“rc”: 0,
“start”: “2020-02-17 21:50:56.779829”,
“stderr”: “”,
“stderr_lines”: ,
“stdout”: “["dev/xvdj","dev/xvdk"]”,
“stdout_lines”: [
“["dev/xvdj","dev/xvdk"]”
]
}
}
Expected value to store in variable : ["dev/xvdj","dev/xvdk"]
But it is storing this variable value: [u’dev/xvdj’, u’dev/xvdk’]
Tel me know how to solve this issue.