Is lua called from redis interpretted or compiled? - compilation

Redis supports lua scripting. Using eval command, we can execute a lua script in redis. Is the lua script compiled or interpretted when redis calls a lua script?

Lua scripts sent to the Lua library for execution are always compiled to Lua VM instructions before execution. These instructions are then interpreted by the Lua VM.

Related

Calling Bash scripts from Matlab with W10 Linux subsystem?

I am making routinely system calls from Matlab (R2016b on W10 64) to integrate some ImageMagick functions. Now I have just read about the existence of the W10 Linux subsystem. Is it possible to call with this option given Bash scripts from Matlab that implement themselves long ImageMagick processing pipelines? And if yes how?
You can run a script from Matlab using !<script> or system(<script>). See this or this for calling convert as an example.
With
bash -c "command"
one can access the Bash shell from the Command Prompt, PowerShell, or elsewhere in Windows so this could be the way to call a Bash script from Matlab link .

Running shell script in WxWidgets

I need to run shell script from WxWidgets application.
Is there a possibility to execute shell script from WxWidgets application?
If so, I want to learn how to do it?
I think you mean wxExecute()
wxExecute("/path/to/your/script");
If you want to execute an external application (be it a shell script or not), you should indeed use wxExecute() as already mentioned in the other answer.
If you want to run a shell built-in command, or use other shell-specific features such as IO redirection, you need to use wxShell().

Run the shell commands in Perl using system() function in Windows

I am migrating some plugin from Linux to Windows.
Plugin is written using Perl and it has the function called system() that will execute the shell commands.
But I am migrating to Windows now. Any way I can run the linux command in windows using system() Per function?
Some Perl Module avail for this ?
You can run the system() command but there are caveats. A nice description is contained in Using system or exec safely on Windows. This article resulted in the Win32::ShellQuote module.
You want to run a linux command vie Perl in a windows shell? If so, try a Linux environment like Cygwin (www.cygwin.com). Otherwise you have to migrate your system calls as well.

how to start a new session in a shell script in platforms other than Linux?

I have this problem:
I have a script A, and it calls another script B, but this script B must run in another session, it is an easy job to do in a C program with setsid
(), but I cannot find an equivalent shell command. There is a setsid shell
command in Linux, but there are no such commands in AIX and other UNIX
platforms. Can anyone give me some advice on how to do it in AIX and other UNIX platforms? Thank you.
The setsid() system call exists in FreeBSD and OpenSolaris, and is part of POSIX.1. So I would think that it should exist in anything that claims to be POSIX-compliant.
AIX is fully compliant with "one or more" of the POSIX standards, but I've never used it, so I can't comment on it directly. Since it's a vendor-supported operating system, I recommend you touch base with your vendor.
Now.. What do you mean by "an equivalent shell command"? What do you mean by "session" in the context of a shell script? If what you're looking for is a way to run a second shell script with a separate controlling terminal from the original script, I suggest you look at GNU Screen instead of system calls. Screen should be available for AIX.
If you have a shell script that currently works for you in Linux, and you're trying to port it to other platforms, then include the script in your question. Otherwise, we're flying blind.

Tcl script cannot be executed from bash shell script

I have a relatively strange problem with bash shell scripts and tcl scripts, invoked from within the shell scripts.
In perspective, I have a shell script that generates some other shell scripts, as well as tcl scripts. Some of the generated shell scripts invoke tcl scripts with tclsh command.
The files are created and stored in a directory, also created by the initial shell scripts, that generates the files and the folders where these are to be stored.
The problem is with the generated shell scripts, which invoke tclsh to run a tcl script. Even if the files are generated and the shell scripts have the permissions to be executed, the response from the shell is that the tcl file embedded in the shell script cannot be found.
However, the file exists and I can open it with both vi and gedit, RHEL 9.0 or Centos 5.7 platforms. But, when I take the same shell script out of the created directory, this error does not appear. Can you please suggest any idea? I checked also directory permissions, but they seem ok. I also checked the shell script for extra characters, but I did not find anything.
It's hard to tell what exactly is going wrong from your description; you leave out all the information actually required to diagnose the problem precisely. However…
You have a tclsh on your PATH, but your script isn't running despite being chmodded to be executable? That means that there's a problem with your #! line. Current best practice is that you use something like this:
#!/usr/bin/env tclsh
That will search your PATH for tclsh and use that, and it's so much easier than any of the alternative contortions.
The other thing that might be causing a problem is if your Tcl program contains:
package require Tcl 8.5
And yet the version of Tcl used by the tclsh on the path is 8.4. I've seen this a number of times, and if that's your problem you need to make sure that the right Tcl rpm is installed and to update your #! line to this:
#!/usr/bin/env tclsh8.5
Similarly for Tcl 8.6, but in that case you might need to build your own from source as well and install that in a suitable location. (Tcl 8.6 is still only really for people who are specialists.)
(The issue is that RHEL — and Centos too, which tracks RHEL — is very conservative when it comes to Tcl. The reasons for this aren't really germane to this answer though.)
Could the problem be as simple as the fact that you don't have "." in your PATH? What if instead of calling your script like "myscript.tcl" you call it like "./myscript.tcl" or "/absolute/path/to/myscript.tcl"?

Resources