Passing osascript via .Net CORE gets syntax error: A unknown token can't go here The following command,

osascript -e 'tell app "terminal" to do script ("idevicesyslog -u UUID | tee 'ios_syslog.txt'")'


(where UUID is the hard-coded device id) works fine in Terminal. It opens a new window and runs the script, but when I pass it in via a .Net CORE api call I get the above syntax error.

Even just osascript -e 'tell app "terminal" to do script ("idevicesyslog")' fails with the same error.

Any thoughts?
WORK AROUND:
I solved the issue by putting the above in an Applescript and calling the script from C#. Meant having to add a non .Net file to the project which can only be edited on a Mac (so far as I know). Script is:

on run argv
    tell application "terminal"
        activate
        do script ("idevicesyslog -u " &amp; item of argv &amp; " | tee '" &amp; item 2 of argv &amp; "'")
    end tell
end run


The script was called by using System.Diagnostics.Process and passing in osascript.exe and the two arguments into the ProcessStartInfo constructor.