• 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
do shell script and redirection fun!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

do shell script and redirection fun!


  • Subject: do shell script and redirection fun!
  • From: email@hidden
  • Date: Fri, 9 Aug 2002 14:29:39 -0700

More shell related than script related, but...

The problem in a nutshell:
I want root to do a command that reads from standard in

More complexly:
I want root to:
echo bar >> /etc/foo.txt
But in order to do that, I need to do:
do shell script "echo password | sudo -S echo bar >>
/etc/foo.txt"
which doesn't work, because the sudo effects the echo, but not the
redirect.
If I was in bash, I could do:
do shell script "echo password | (sudo -S (echo bar >>
/etc/foo.txt))"
which tells the shell that the last parts are complete commands.
Makes sense.
But sh doesn't do this.

So, wizards, how does this one work?
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Seth A. Roby
Scriptwriter Intern
"Life is like an exploded clown. It's really funny until you figure out
what just happened."
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: do shell script and redirection fun!
      • From: garbanzito <email@hidden>
  • Prev by Date: AppleWorks bug. Can someone please confirm
  • Next by Date: RE: Open For Access Broken in 9?
  • Previous by thread: Re: AppleWorks bug. Can someone please confirm
  • Next by thread: Re: do shell script and redirection fun!
  • Index(es):
    • Date
    • Thread