Re: do shell script with administrator privileges & shell commands
Re: do shell script with administrator privileges & shell commands
- Subject: Re: do shell script with administrator privileges & shell commands
- From: Christopher Nebel <email@hidden>
- Date: Wed, 14 Aug 2002 12:37:22 -0700
On Wednesday, August 14, 2002, at 10:14 AM, Sander Tekelenburg wrote:
At 16:15 -0700 UTC, on 8/13/02, Chris Espinosa wrote:
do shell script "command > /dev/null 2>&1 &"
(The > /dev/null redirects standard output, the 2>&1 redirects
standard error, and the final & puts the command in the background.)
Could you explain "2>&1"?
If I understand correctly what /dev/null is (a sort of 'trash'), then
I would
guess that redirecting standard error to "2>&1" is the same idea:
ignore all
errors. Is that correct?
"do shell script" will wait until both the standard and error output
streams from the child process return end-of-file. The point of the ">
/dev/null 2>&1" is to redirect all output away from the parent process
(i.e., the script) so this happens immediately. The "> /dev/null"
sends normal output to the "file" /dev/null (as you surmise, a sort of
trash or "bit bucket"); and the "2>&1" sends error output (the "2") to
the same place as standard output (the "1"). You could get the same
effect by saying "2> /dev/null", but "2>&1" is shorter.
In fact, the "/dev/null" could be any file, and the detach would still
work, and you'd get the output from the process in that file.
Sometimes, this is exactly what you want, but most of the time the
output from daemons isn't interesting.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.