Do shell script as Administrator

Hi all,

I’m trying to run a shell script as a different user, and I can’t seem to get it right.

do shell script "echo " & quoted form of myVar & " > /file username \"myuser\" password \"mypass\"" with administrator privileges

I don’t get any applescript errors, but it doesn’t execute either. When I try to run this directly in my shell, I get a
-bash: /file: Permission denied

error. However, if I change to the user I am trying to run it as first, it runs fine. Is my syntax wrong?

Thanks,
j

You have the parameters inside the string.

do shell script "echo " & quoted form of myVar & " > /file" user name "myuser" password "mypass" with administrator privileges

Hi,

try this

do shell script "echo " & quoted form of myVar & " > /file" user name "myuser" password "mypass" with administrator privileges