input password for terminal script

Hello,

How can I enter a password for sudo in a terminal script? The commented out line works for “do shell script” but not Terminal to do script. I would use do shell script but I want to see the progress in a terminal window.

tell application "Terminal" to do script "sudo /usr/bin/runpsync 0 -d -r '/Volumes/MyDrive 'NewDrive'" --password "xxx " with administrator privileges

So if someone could tell me either how to display progress of do shell script or how to enter the password when using Terminal do script I would greatly appreciate it.

Thank you,

Damon

Check out the following thread – read Camelot’s post, he explains the “sudo” command pretty well in his reply…

http://bbs.applescript.net/viewtopic.php?t=5710&highlight=sudo

Thank you for the reply.

The problem is that I can get “sudo” and “Password” working with “do shell script” but not “Application “Terminal” do script”. I would like to see psync status in a terminal window so I hve to use “Terminal” do script" .

If I use "Application “Terminal” do script password is not recognized. If I use do shell script password works but I get no status from rsync, it runs silently.

Password command works

do shell script "sudo /usr/bin/runpsync 0 -d -r '/Volumes/source' '/'" password "xxx " with administrator privileges

Password command doesn’t work

tell application "Terminal" to do script "sudo /usr/bin/runpsync 0 -d -r '/Volumes/source' '/'" password "xxx " with administrator privileges

[/u]