• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Scripting su or sudo on OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting su or sudo on OS X


  • Subject: Scripting su or sudo on OS X
  • From: Gary Beberman <email@hidden>
  • Date: Thu, 6 Dec 2001 16:24:21 -0800

I know that to call Unix commands in OS X I can use Terminal or OSX PowerAddOns OSAX. These appear great for scripting individual commands to execute.

But, what if the command requires interaction. Suppose I need to su to a different ID or sudo a command and I get asked for a password. How do I provide a reply? I have naively tried variations on:

tell application "Terminal"
tell window 1
do script with command "su root"
tell me to delay 5
do script somePW & return
end tell
end tell

and gotten nowhere.

Thanks,

Gary


  • Follow-Ups:
    • Re: Scripting su or sudo on OS X
      • From: garbanzito <email@hidden>
References: 
 >Re: Program linking issues... (From: hcir <email@hidden>)

  • Prev by Date: Re: AppleScript Studio...?
  • Next by Date: Re: Cross version compatible way to set the file pointer to eof
  • Previous by thread: Re: Program linking issues...
  • Next by thread: Re: Scripting su or sudo on OS X
  • Index(es):
    • Date
    • Thread