Re: sudoing into root
Re: sudoing into root
- Subject: Re: sudoing into root
- From: Graff <email@hidden>
- Date: Sun, 23 May 2004 04:28:17 -0400
First of all, "sudo -s" creates a new shell which only lasts for the
duration of the "do shell script" command. So when you execute the
next "do shell script" command you don't have the privileges that you
think you have.
Secondly, be very careful with this! If you mess up you could
accidently mess up the mDNSResponder directory. Using your command I
managed to gzip its contents as individual items in-place. Luckily it
was easily reversible by going back into the shell and issuing the
command:
----
gunzip -r /System/Library/StartupItems/mDNSResponder/
----
A better option would be to duplicate the mDNSResponder directory and
then work on the copy. That way if you mess up you are working on a
copy and no harm is done.
If what you want to do is to gzip the entire directory into a single
file then you should use tar, not gzip. Gzip just compresses stuff
individually, tar is what packages them neatly. Tar will also gzip
directly with the -z flag. Here's an example:
----
do shell script "cp -R /System/Library/StartupItems/mDNSResponder
~/Desktop/"
do shell script "tar -czf ~/Desktop/mdns.tgz ~/Desktop/mDNSResponder"
----
If you like to live on the wild side you can do that in one command:
----
do shell script "tar -czf ~/Desktop/mdns.tgz
/System/Library/StartupItems/mDNSResponder"
----
- Ken
On May 23, 2004, at 2:51 AM, Gnarlodious wrote:
I can do this in Terminal:
sudo -s
gzip -r /System/Library/StartupItems/mDNSResponder >
/System/Library/StartupItems/mDNSResponder.gz
Can you?
But I can't do it in Applescript:
do shell script "sudo -s" with administrator privileges
do shell script "gzip -r /System/Library/StartupItems/mDNSResponder >
mDNSResponder.gz"
-- > /bin/bash: line 1: password: command not found
What am I doing wrong?
_______________________________________________
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.