LC Server: shebang breaks tags?

Brian Milby brian at milby7.com
Sat Feb 8 00:16:50 EST 2020


Can’t answer regarding the design decision, but here is the pertinent line:

One recent feature that was introduced in LiveCode 6.6 was the ability to use hashbangs (#! /path/to/livecode) in LiveCode server scripts instead of script open and close tags (<?lc ?>).

Of note is the “instead of” statement which leads me to believe that it was designed that way.  It makes sense if trying to use it for automation since you don’t need the code tags.

I would guess that a command line parameter could be added to have it work the other way.

Thanks,
Brian
On Feb 7, 2020, 11:05 PM -0500, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com>, wrote:
> LC Server 6.6 and later allows you to use LC as you would other system
> utility languages, by including the path to the engine on the first line
> following a shebang - see discussion here:
> https://livecode.com/livecode-server/
>
> This lets us use the old MetaCard style with command line scripts,
> without needing to put "<?lc" and "?>" around the code.
>
> But oddly, it seems that running a script this way not only doesn't need
> to comment wrappers, it actually tries to execute them - and of course
> fails.
>
> For example, this script:
>
> #! ./lcs
>
> <?lc
> put the long date && the long time
> ?>
>
> ...throws this error:
>
> row 3, col 1: script: not a command (<)
>
>
> Weirder, I've found that if I omit the shebang and call the engine
> directly in the path on the command line it runs well:
>
> ./lcs test.lc
>
> What is it about the shebang that's breaking execution in comment blocks?
>
> I have a need to embed code within larger blocks of non-code, and had
> considered using LC Server as a helper app for that.* It doesn't matter
> much to me if I launch it with the app path or not, but since most of my
> systems have LC Server installed for general use it would be nice to use
> the shebang method. So this seeming anomaly is certainly not critical,
> just odd.
>
>
>
> * Yes, I know I can use the merge function for this, but LC desktop's
> merge is far more limited to the implicit merge that happens when using
> LC Server.
>
> The merge function doesn't continue code execution across blocks of code
> separated by non-code, whereas LC Server does this well:
>
> <?lc if there is a file "something" then ?>
> This is some non-code
> <?lc else ?>
> Some other non-code
> <?lc end if ?>
>
> Maybe we could have the desktop merge function expanded to work like
> Server's implicit merge? That would be most awesome.
>
> --
> 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