Hello,
I want to pass a shell command from an Applescript application. The command is generated from unpredictable user input.
do shell script "echo " & (quoted form of OriginalText & ShellCommand)
returns an error in many cases when the ShellCommand contains single quotes.
One trick that worked for sed I found goes like
do shell script "echo " & quoted form of OriginalText & " | tr '\\r' '\\n' | sed -e " & quoted form of sedCommand
by Aurelio Jargas. Aurelio uses quoted form of to get the single quotes around a sed program while escaping those within the program. I am looking for a trick to allow user input other than sed.
Chrys had explained (2008-09-20 07:15:00 am):
This would require to break the user input into parts that are quoted-form-of-ed, and parts that are not. Because the input is not predictable, this seems impossible, and I guess I need to use something other than applescript. A “call method” (if that’s nonsense, sorry, I’m new to everything beyond AS)? Is that correct? What should I use?
Willing to learn (even to buy a book, yeah! just give me some directions, please),
LG