Poke a Shell Variable with xTalk?

Jim Ault JimAultWins at yahoo.com
Tue Sep 13 22:10:08 EDT 2005


This may help, then again, maybe it does not apply to your situation

http://developer.apple.com/technotes/tn2002/tn2065.html

Q: How long can my command be, really?

A: Calling do shell script creates a new sh process, and is therefore
subject to the system¹s normal limits on passing data to new processes: the
arguments (in this case, the text of your command plus about 40 bytes of
overhead) and any environment variables may not be larger than kern.argmax,
which is currently 262,144 bytes. Because do shell script inherits its
parent¹s environment (see the next question), the exact amount of space
available for command text depends on the calling environment. In practical
terms, this comes out to somewhat more than 261,000 bytes, but unusual
environment settings might reduce that substantially.
Note: This limit used to be smaller; in Mac OS X 10.2 it was about 65,000
bytes. The shell command sysctl kern.argmax will give you the current limit
in bytes.

On 9/13/05 6:36 PM, "Sivakatirswami" <katir at hindu.org> wrote:

> OK the above works, but I want to try now piping tMsg straight into
> Send mail *without* saving or reading a file from the hard drive
> (why? some new security thing in OSX, Postfix preventing more than
> 1024 chars input without introducing a CRLF... even right in the
> middle of a word, I'm getting a space in the middle of a word in the
> HTML version a complete bad line break in the middle of a word (every
> 1024 chars) in the text alternative)

or maybe you need to interact with the process directly as in

Q: I have started a background process; how do I get its process ID so I can
control it with other shell commands?

A: You can use a feature of sh to do this: the special variable $! is the ID
of the most recent background command, so you can echo it as the last
command in your shell script, like this:
do shell script "my_command &> /dev/null & echo $!"
-- result: 621
set pid to the result
do shell script "renice +20 -p " & pid
-- change my_command's scheduling priority.
do shell script "kill " & pid
-- my_command is terminated.



More information about the use-livecode mailing list