Poke a Shell Variable with xTalk?

Jim Ault JimAultWins at yahoo.com
Tue Sep 13 12:42:51 EDT 2005


I am not a shell or *nix guy, but I did find this today.  Shows what and how
to create variables (poke)

At the bottom of the tech note on this Apple page updated for Tiger:
http://developer.apple.com/technotes/tn2002/tn2065.html

--snip--
Q: Where does the shell environment come from ‹ environment variables,
working directory, and so on?

A: do shell script inherits the environment of its parent process. Because
of how scripting additions like do shell script work, the parent process is
the application for the tell block surrounding the do shell script call. If
there is no surrounding tell block, or if you tell me, the parent is the
application running the script.

The environment covers the working directory, any environment variables, and
several other attributes ‹ see the execve(2) man page for a complete list.
As mentioned in Issuing Commands, do shell script does not read the
configuration files that an interactive shell running in Terminal would.

Any application launched from the Finder gets the same default environment:
a working directory of / and the environment variables HOME, LANG, PATH,
USER, and SHELL. (You can define more environment variables if you wish; see
Technical Q&A QA1067, Setting environment variables for user processes for
details.) Most applications do not change their environment, but relying on
this is a maintenance risk.

osascript(1) inherits its environment from the shell it¹s run from: the
working directory is the working directory of the shell; any environment
variables defined in the shell will also be defined in osascript, and
therefore in do shell script. For example:
$ VAR=something; export VAR
$ osascript -e 'do shell script "echo $VAR"'
something

sh defines a number of environment variables of its own, but those are the
same no matter how it¹s run.


On 9/12/05 10:52 AM, "Sivakatirswami" <katir at hindu.org> wrote:

> Can we pass data from a local variable in Revolution to a variable in
> shell.? How?
> 
> eg.
> 
> in shell
> 
> cat <<some_variable
> test
> test
> test
>>> some_variable
> 
> gives us "$some_variable"
> 
> where
> 
> echo $some_variable  #gives us
> 
> test
> test
> test
> 
> 
> 
> now what we want to do is
> 
> put "Greetings to all innovative Revolutionaries" into tGreeting
> 
> [pseudo code here:]
> 
> put tGreeting into $Greeting
> 
>   set the shellcommand to "/bin/sh"
>    put "cat $Greeting" & " | sendmail -f hpi.list at hindu.org " & (fld
> "to" of cd "staticText")  into tCmd
> 
>    put shell(tCmd) into tResult
> 
> # where the contents of $Greeting is piped to sendmail...
> 
> I know we can read $ variable from the system, but can we create and
> poke them?
> 
> TIA
> 
> Sivakatirswami
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list