How to create a link to execute Matlab from terminal

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
Axolotl

How to create a link to execute Matlab from terminal

Post by Axolotl »

Hi

I have installet Matlab on /My_user/Programs/Matlab and the executable matlab file is /My_user/Programs/Matlab/bin/matlab . I want to create a "command" to execute Matlab from the terminal but I don't know how. I already tried to use "ln -s /complete-route/ matlab " but when I write "matlab" nothing happens. I know maybe this is a very newbie question but I'm stuck

I'm also want to create a launcher for matlab in my desktop but when I try to open it says "Broken Link" but I'm sure I wrote the correct adress

Thanks
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29504
Joined: Wed Jul 06, 2011 3:58 am

Re: How to create a link to execute Matlab from terminal

Post by xenopeek »

Moving this here as this isn't a tutorial but a support request.

If you want to run a file in your current directory, you have to precede it with "./" to make clear the file should not be search for in the path but in the current directory. So if you have created a symbolic link to matlab, run it from the directory where you have that symbolic link with:

Code: Select all

./matlab
Image
itsme4401

Re: How to create a link to execute Matlab from terminal

Post by itsme4401 »

Remember: almost all varieties of Linux are case-sensitive!
You're speaking about Matlab and matlab, so check that first.
I have installet Matlab
&
ln -s /complete-route/ matlab
baptiste

Re: How to create a link to execute Matlab from terminal

Post by baptiste »

Sorry, this topic is a bit old but I believe the proper way to run such things from the command line, or at least an easy one, is with aliases.
An alias is a simple command substitution done by the bash command prompt, you only have to type alias matlab='/my/path/bin/matlab'

I use just a few aliases for little stuff I would otherwise type all over again but don't need to be in a script at all.
These go in ~/.bashrc (source .bashrc reloads it)
also I have a shorthand alias cd..='cd ..', because it's one space less to type and worked in DOS/Windows :oops:
Locked

Return to “Scripts & Bash”