How can I stop AppleScript from converting variables like "\087" into their octal form when passing through bash?

by Brandon Steenhoek   Last Updated July 12, 2019 01:12 AM - source

I have a program I'm using to write xml with variables, and it passes through AppleScript and bash to form the final xml. However, one of my variables usually begins with "024", "054", or other three digit codes that paired with the "\" forms an octal character, like "," for "\054". Once they are passed through bash, they become replaced with these octal characters. These variables need to stay the way they are, because they are part of a file path the xml ultimately pulls from. Unfortunately, I can't change these variables because they're linked to many other things working properly, and the backslashes are obligatory too. I want to know if there is a way to stop AppleScript from implementing octal encoding on this script as it passes through. A colleague recommended using iconv, which I tried unsuccessfully, partially because I'm not sure how to use it properly. Here is the AppleScript for reference:

do shell script "echo \" W:\\Sequences\\054_TLD_TL_Taking_The_Lead\\Shots\\TLD0640\\Versions\\MOV\\\\TLD0640_v0173\ \" > ~/Desktop/Test.xml"

And the output:


For some reason, even though I copy and pasted the entirety of both codes into this text box, it truncated them to these small sections of each. I will attempt to leave a comment with the full scripts. Thank you for your help!

Related Questions

Run AppleScript from bash script

Updated April 22, 2015 04:05 AM