How can I run Lua through the terminal WITH file path? - cmd

I have added lua's interpreter to path and it works with file names but I can't run lua through the terminal with file path. I am looking for a way to run lua through the terminal with the file path. I've encountered this while making a macro to automatically run lua files. My macro to run lua in Visual Studio Code uses this argument in keybindings:
"args": { "text": "lua '${file}'\u000D" }
I have tried the command of lua D:/Downloads/Useful stuff/code/lua/a.lua but I'm getting the error: lua: cannot open D:/Downloads/Useful: No such file or directory. I have tried that command both without and with '', both of them don't work.

Related

Permission Denied When Building in Sublime Text 3

I am attempting to utilize Lua on Windows 10 with Sublime Text 3. When I attempt to build and run a script I receive the following error:
lua: cannot open C:\Program Files (x86)\Lua\5.1: Permission denied
I have added full permissions to the folder.
I am only attempting to run a simple print statement:
print("hello")
The expected result is hello output in the results window.
The build system that ships with Sublime for executing Lua programs looks like this:
{
"cmd": ["lua", "$file"],
"file_regex": "^(?:lua:)?[\t ](...*?):([0-9]*):?([0-9]*)",
"selector": "source.lua"
}
The important aspect here is that the command to be executed is lua with a first argument that is the name of the current file. From the error message you're seeing, Lua looks like it's trying to execute a directory instead of the name of a program. Or if you will, if this was a directory permission problem I would expect it to tell you the name of the file that it can't access, not the folder than the file is stored in.
It's also suspicious that the name of the folder is the install location for lua itself, and that the error message seems to indicate that it's lua itself generating the error.
Based on all of this, my guess would be that you didn't save your Lua script before you executed the command. That would cause $file to expand out to an empty string, making the first argument empty. Since the build is using cmd, internally windows is being told specifically to run a program named lua with an empty string as it's first argument.
It looks like the interpreter first tries to put the current working directory onto the filename and then execute it, and since the file name is empty, it ends up trying to execute a directory, which is where the permission problem comes from.
Once you save the file the first time and it has a name, Sublime will automatically re-save it every time you run the build as long as Tools > Save all on build is checked; that option won't prompt you to save brand new files that don't have names yet, though.

I Cant get Ruby Packer to work and need a method to package a Ruby application

I have a ruby script that I run from the terminal, however I want to be able to double-click an icon like I would an application and run the script. I've looked at ruby-packer, but it isn't working for me.
What is the best option to accomplish this?
Im on a mac.
In terminal, I'm not at the directory of the .rb file because when I try to run ./rubyc from the directory containing the .rb file, I get the error command not recognized
When I run ./rubyc /RubyProjects/signOff.rb /signOff.out I'm able to get it to run, but the outfile file is called rubyc that just re-runs the same code when I double-click it. I'm at a loss for how to get it to work properly.
`
The -o parameter defines the output filename:
rubyc -o signOff signOff.rb

How to run PSPP syntax file from the command line (CMD)?

I have the following syntax written in PSPP .sps file:
GET FILE = '... result.sav'
save translate
/outfile = '... data.csv'
/type = CSV
/REPLACE
/FIELDNAMES
/CELLS=LABELS.
where ... stand for the path of the files.
The Script works as expected, so when I open PSPP and run it, it opens the first file and saves it as another CSV file. However, I would like to do two more things:
Call this file from CMD (in Windows) so it will execute all command automatically and silently, without showing the PSPP windows.
Add a line to the syntax to terminate PSPP after execution.
Right now I can only type the name of the .sps file in the CMD and it opens it but does nothing else. I have looked in the official docs but couldn't find any solution for that.
Well, I found the answer myself:
In CMD I had to type:
"C:\Program Files\PSPP\bin\pspp.exe" C:\Users\...\Dropbox\MATLAB\atid\convert_to_csv.sps
And that's all. It runs PSPP in silent mode and creates the file as needed.
What I didn't know was that I need to first write the path of PSPP .exe file ("C:\Program Files\PSPP\bin\pspp.exe") before the name of the syntax file. All the rest just worked.

Compiling .sh file from Matlab on Windows

I am trying to compile .sh file from MATLAB on Windows. When I type mcc -m filename.m it generates .exe file but I would like to run it on Ubuntu server. Is it possible to make it on Windows?
The .sh file extension is typically used for shell scripts. Check the first line of your file. If it reads !#/bin/bash or so, you are looking at a shell script which has nothing to do with matlab. Instead, you may want to install cygwin to have the usual Linux/Unix shell programming environment available on windows.

MSYS error "rem: command not found"

I am getting this error "rem:command not found" in my batch file. Other dos commands (e.g. echo) are also not found.
My makefile is calling this batch file. This works previously when I am using cygwin. But when I changed to MSYS, I am getting this error. Anyone know why this is?
I am using MSYS version 1.0.17 on a Windows pc. But, I did not install Mingw. Should i install it also?
It looks as though you are trying to run a "Batch" file using Bash. This will not work. While Batch file interprets rem as a comment, Bash simply thinks it is a command and tries to run it.
My suggest would be to rewrite it as a Bash script, perhaps this could be a starting point.
After trying with cmd //c [path_to_bat file] it works for me.
This is because mingw cannot run *.bat file directly after running *.bat file with cmd it works.
I found following mail thread about this type of issue
https://lists.gnu.org/archive/html/help-gnu-emacs/2003-10/msg00323.html

Resources