Shell - argv parameter with SPACE

JB sundown at pacifier.com
Sun Jun 25 00:13:23 EDT 2017


THANK YOU!

JB


> On Jun 24, 2017, at 9:05 PM, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> JB wrote:
>> I really did not use the shell command before I started posting
>> the c and java code.
>> 
>> I was starting to learn Python and would love to know hoe to
>> use the shell to integrate it into Livecode stacks.
>> 
>> In fact I would love any shell examples!
> 
> Here's a quickie off the top of my head (read "Don't sue me if it needs tweaking to work" <g>) for using rsync to back up a local folder to a folder on a remote server.
> 
> on mouseUp
>   put fld "SourceDir" into tSrc
>   put fld "DestDir" into tDest
>   put fld "User" into tUser
>   put fld "Server" into tServer
>   put fld "PortNumber" into tPort
>   if tPort is not empty then put "-p " before tPort
>   --
>   put "rsync -az "& tPort &&quote& tSrc &quote \
>         &&quote& tUser &"@" & tServer & ":" & \
>         tDest &quote into tCmd
>   put shell(tCmd)
> end mouseUp
> 
> 
> Note: LC's shell function isn't interactive of course, so you'll want to set up a shared SSH key on the server first for passwordless login.
> 
> If you haven't done it before you'll be glad you did, and even more glad when you've tested that it works well so you can turn off password login altogether (ah, such slender auth.logs after that <g>).
> 
> This is a good guide on setting up shared SSH keys:
> <https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2>
> 
> If you need to handle passwords or other interactions in shell, I don't know of a platform-indendent way to do that.  But in Linux (and maybe Mac if you install via Homebrew) you can use Expect.
> 
> Here are some examples of using Expect with bash:
> <http://www.admin-magazine.com/Articles/Automating-with-Expect-Scripts>
> 
> I had started down the road of making a server management toolkit in LC a while back, but time's hard to come by so I'll likely be using Ansible for that soon.  If I can turn up any of my LC experiments mixing bash and Expect in shell calls I'll post 'em.
> 
> Like most uses of shell, it's just like using the command line but with a lot of confusing concatenation. :)
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com                http://www.FourthWorld.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list