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: garbanzito <email@hidden>
- Date: Wed, 14 Aug 2002 13:18:17 -0600
at 2002 08 14, 19:14 +0200, they whom i call Sander Tekelenburg wrote:
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?
pending an official response ... and written in perhaps less
than perfect unix vernacular:
first, yes, /dev/null is a bit-bucket -- anything sent there
disappears, yet /dev/null appears to be an actual file to
commands, so satisfies their need for somewhere to send
output (try "man null").. "2>&1" is shorthand for "direct
stderr to the same place stdout goes".. it is discussed
somewhat cryptically under "man zshmisc"
now, "do shell script" seems designed to:
a) spawn a shell process (actually /bin/zsh)
b) send the shell process your commands, which the shell
will run as one or more subprocesses [1]
c) collect output from and await completion of the shell
process
a command process in a shell will have (possibly empty)
standard output and standard error.. the shell process takes
these as its inputs and passes them along to the controlling
process (the script in this case)
so sending both stdout & stderr to /dev/null frees the shell
process from passing along the output of the command
process, plus, backgrounding the command allows the shell
process to complete as soon as the command process has
launched (without backgrounding, the shell process would
wait for the command process to finish)
then, since the script detects that the shell process has
completed, it can continue, though it has no idea that the
commands are still running -- it just sees empty output from
the shell process
[1] if the commands are built-in commands of the shell,
there will be no sub-process, and backgrounding won't work
--
steve harley
_______________________________________________
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.