Running MATLAB script from terminal Mac [duplicate] - macos

This question already has answers here:
matlab execute script from linux command line
(3 answers)
How to call MATLAB script from command line?
(4 answers)
Closed 1 year ago.
I am trying to run a matlab script from the terminal on MacOS. I am doing the following:
/../matlab -nodisplay -r
to open matlab from terminal, then to run the script that is on a different path I write
cd ('/.../test/')
test1.m
It runs, I get some error regarding the font. But I am not able to visualise the plots in the script, any suggestions?

Related

How to access WSL PATH from Powershell core? [duplicate]

This question already has an answer here:
What is the difference between calling a command via "wsl [command]" and opening a wsl shell and calling "[command]"?
(1 answer)
Closed 1 year ago.
If I open up the Ubuntu app (terminal) and type echo $PATH, I get a bunch of directories. If I type wsl echo $PATH in Powershell core, I get absolutely nothing (a blank row). I would like to run a Linux command from Powershell core, how do I do that?
That's because the .bashrc isn't run when you just run wsl <command>, you need to run wsl bash -c '<command>', or run <command> while inside a bash shell.

If I put a bunch of curl commands into a .sh file, and run it, will it run those commands? [duplicate]

This question already has answers here:
Run text file as commands in Bash
(5 answers)
Closed 4 years ago.
Sorry, seems like a stupid question but I cannot find an answer (and am not on mac to test)!
In Windows, I open notepad and copy/paste in a bunch of curl commands, save as a .bat and click on it. Then it runs, easy peasy.
In Mac, will I get the same behaviour if I save the file as .sh? Do I need to install anything from terminal?
Sure, and you don't even need the .sh extension although its handy to help you recognize scripts. Just open a text file in your favorite editor. Type in the curl commands you want to run and save the file. There are two ways to run the file from the bash shell. you can
source filename
Or type:
chmod +x filename
to make the file executable and then type
./filename
to run it.

How do i run url command from my terminal? [duplicate]

This question already has answers here:
Execute bash script from URL
(16 answers)
Closed 4 years ago.
I have commands for example like this:
git clone https://example.com/mygit.git && cd mygit && npm i
in a file that i uploaded to an url, I want to run it from terminal, how do I run it from my terminal?
Are you using a Linux distro or Windows?
Assuming its Linux - you need to have the file execute permission bit set ( see here for more information -> https://www.tutorialspoint.com/unix/unix-file-permission.htm )
Then you need to execute the file with the path specified ie. if the script is called "myScript.sh" you would run:
./myScript.sh
or
/path/to/myScript.sh

Identify underlying OS in bash on windows [duplicate]

This question already has answers here:
How to check if a program is run in Bash on Ubuntu on Windows and not just plain Ubuntu?
(15 answers)
Closed 5 years ago.
Is there a simple way to determine if bash is running on Windows? Running uname gives "Linux" which is not correct.
I have not personally tested this but if [ -d /mnt/C ] may work.
This is probably a terrible solution

Running a command behind BASH prompt in bashrc [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Start background process from .bashrc
I'm executing a script in .bashrc and the user prompt will not appear until all commands have executed. Is there a way, on launching a terminal, that the prompt appears while the commands execute in the background?
Thanks for any assistance!
append & to your command to have it run in the background.

Resources