I have a short bash script to replace a uuid in a line in a file:
#!/bin/sh
alpha="0-9A-F"
uuidPtn="[$alpha]{8}-[$alpha]{4}-[$alpha]{4}-[$alpha]{4}-[$alpha]{12}"
ProductCode="\"ProductCode\" = \"8:{0059DDB5-D384-46F9-BBFD-0004A8C39732}\""
newguid=`uuidgen`
newguid="${newguid^^}"
cmd="echo $ProductCode | sed -r s/$uuidPtn/$newguid/"
echo "$ProductCode"
eval "$cmd"
It produces almost correct output, but with the quotation marks omitted:
"ProductCode" = "8:{0059DDB5-D384-46F9-BBFD-0004A8C39732}"
ProductCode = 8:{A4B1D092-1C56-44F3-B096-34B67A5F39B1}
How can I include the quotation marks?