Poke a Shell Variable with xTalk?

Sivakatirswami katir at hindu.org
Tue Sep 13 21:36:16 EDT 2005


Mark, yes, I did finally find in the docs this bit about poking the  
shell variables... I think now my wall of fire is ignorance on shell  
syntax. Let me be very specific

This script builds a mult-part email msg and endeavors to send to our  
mail serve on the LAN via sendmail which has been enabled on local  
machines... (why? because mail.app on the mac will not forward html  
email as such...)

It looks like this now...

## a whole bunch of code takes input from a field and builds the  
email msg and puts into tMsg  local.

## so, now we save it to the editor's desktop

   put ($HOME &"/Desktop/temp.txt") into tPath
   put tMsg into url ("binfile:" & tPath)

   # Do shell stuff and send mail
   set the shellcommand to "/bin/sh"

   put "cat " & quote & tPath & quote & " | sendmail -f  
hpi.list at hindu.org " & (fld "to" of cd "staticText")  into tCmd

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)

#######

#### So, let us  try this:

put tMsg into $DailyHPIEmai  l # quite right, this does work...

set the shellcommand to "/bin/sh"
put "cat " &  $DailyHPIEmail  & " | sendmail -f hpi.list at hindu.org "  
& "katir at hindu.org"  into tCmd

## or use redirect... same thing...:

put "Sendmail -f hpi.list at hindu.org " & "katir at hindu.org" & "<  
$DailyHPIEmail"  into tCmd

--put tCmd # use this to check the cmd string and copy and test from  
terminal
--exit to top

   # check on status and inform user
   put shell(tCmd) into tResult
   if tResult is empty then
     answer "Mail was sent...." with "OK"

###########


This doesn't work... "cat" is expecting a file name in the current  
directory inside the container "$DailyHPIEmail"

Of course it fails when it gets a multi-line input... So I need the  
shell syntax for

[take this multi-line text and pipe it thru as stnin to] | sendmail - 
f hpi.list at hindu.org " & "katir at hindu.org"

I guess this if verging on OT now... meanwhile I will continue my  
search through the oceans of Unix cmds... "cat" is  obviously the  
wrong choice here to get $DailyHPIEmail  to be written straight into  
StnIn pipe to | Sendmail

Thanks!

I may bail out here and end up using Shao Sean's SMTP Lib, more  
complicated perhaps, but a least it is all transcript!


Sivakatirswami







On Sep 13, 2005, at 6:52 AM, Mark Waddingham wrote:

> You can both read and write to shell variables in Revolution. So the
> following:
>   put foo into $FOO
>   put shell("echo $FOO")
> Results in what you would expect in the message-box :o)
>
> In other-words, what you are trying to do should work fine...
>
> Hope this helps!
>
> Mark.
>
> On Mon, 2005-09-12 at 07:52 -1000, Sivakatirswami 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
>>
> -- 
> ------------------------------------------------------------------
>  Mark Waddingham ~ 36degrees at runrev.com ~ http://www.runrev.com
>        Runtime Revolution ~ User-Centric Development Tools
>
> _______________________________________________
> 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