Thanks for the better test. I didn't fully understand what shlex was aiming for. I see the correct output now.
#!/bin/bash
outputVar=$( cat << EOF | python fileString = "'SanDisk''" output = "'" + fileString.replace("'", "\'\"\'\"\'") + "'" print output quit() EOF )
sh -c "echo $outputVar"
'SanDisk''
« Back to merge proposal
Thanks for the better test. I didn't fully understand what shlex was aiming for. I see the correct output now.
#!/bin/bash
outputVar=$( replace( "'", "\'\"\'\"\'") + "'"
cat << EOF | python
fileString = "'SanDisk''"
output = "'" + fileString.
print output
quit()
EOF
)
sh -c "echo $outputVar"
'SanDisk''