• 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
Re: do shell script "sudo -v"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script "sudo -v"


  • Subject: Re: do shell script "sudo -v"
  • From: Sean Elfstrom <email@hidden>
  • Date: Fri, 14 Dec 2001 15:56:05 -0600

At 1:37 PM -0800 12/14/01, Timothy H. Kaiser, Ph.D. wrote:
>I want to run a command that requires input using
>
>do shell script
>
>in particular I want to run sudo -v
>
>set input to "sudo -v"
>set theResult to do shell script input as string
>
>sudo asks for a password.
>
>So what i want to do is something like
>
>set input to "sudo -v & return & "my_password" & return
>
>but that does not work since (I assume) my_password is not
>sent until sudo returns.
>
>Any ideas?

You can pass in the password like so:

Shell "echo 'somePW' | sudo -S somecommand"

I wouldn't recommend using this method with scripting Terminal, because the password will be in plaintext in the title bar and the window, but it should work fine with OSX PowerAddOns or Kinder Shell.

--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Sean Elfstrom email@hidden | ImagiQ http://www.ImagiQ.com/
XO/Mac Wrangler PGP:0x716F29D6 | 2325 NW Military, Suite 103
Apple Product Professional O- | San Antonio, TX 78231
Apple Authorized Sales & Service | 210-377-3545 800-750-0787


  • Follow-Ups:
    • Re: do shell script "sudo -v"
      • From: garbanzito <email@hidden>
References: 
 >do shell script "sudo -v" (From: "Timothy H. Kaiser, Ph.D." <email@hidden>)

  • Prev by Date: do shell script "sudo -v"
  • Next by Date: Re: even better coerce to record with usrf
  • Previous by thread: do shell script "sudo -v"
  • Next by thread: Re: do shell script "sudo -v"
  • Index(es):
    • Date
    • Thread