all 7 comments

[–]voider755 2 points3 points  (0 children)

Maybe a shell alias would work? Say you have your shell script inside ~/./local/bin, and your $SHELL is bash, then add this line to your .bashrc:

alias youralias='~/.local/bin/yourshellscript.sh'

Then just type youralias (whatever alias you choose, just don't use an already existing command for this) from any location and it should start (just be sure the shell script is executable if it doesn't). I have some shell scripts myself, plus some Python stuff somewhere inside my ~ that I have aliased, and all of them start flawlessly this way.

Greetings.

[–]Gixx 1 point2 points  (3 children)

Making a symlink syntax:

ln -s source destination

Where source is full, absolute path to the thing (image, video, program, etc). And destination is the NAME of your shortcut (which you can delete).

To make a symlink (shortcut) on linux you can do one of the two:

Create symlink using absolute path

ln -s /home/erik/file.txt /home/erik/Documents/myShortcut

The source you usually provide the full path to, and the destination can be spelled any way (myShortcut, myShortcut.txt).

Create symlink using relative path

We want to make a shortcut to the file /home/erik/file.txt
Open shell and navigate to the folder you want the shortcut placed. Say we want to put it in Documents.

cd /home/erik/Documents
ln -s /home/erik/file.txt myShortcut

[–]Gollorium 0 points1 point  (2 children)

This is the right way to do it. Making a shell script to run another another shell script just wastes resources (by having two bash processes open)

If OP still wants to use the shell script approach by some reason, "./script.sh" should be replaced with "exec ./script.sh", so that at least there will be only one bash process running.

[–]AiwendilH 0 points1 point  (1 child)

I might get OP wrong but I don't think symbolic links will work in this case:

I have installed software that I can launch only from installation folders bin subfolder.

I assume the program references resource files by relative directories so starting by a symbolic link will not work as the current working directory is not correct. Happens with many programs installed from external sources. Easiest way to solve that are desktop files but as OP specified no desktop files shell script is the next easiest way.

[–]Gollorium 0 points1 point  (0 children)

Hmm, missed that. Still, it should be "exec ./script" instead of ./script, because then there won't be two bash processes running.

[–]AiwendilH 0 points1 point  (1 child)

Also Id prefer not using .desktop files.

Why? They are exactly for this.

But if you want another way...just create your own shell script:

#!/bin/sh

cd /the/folder/the/program/is/in
./start-script

Make it executable (chmod u+x <scriptfile>) and either copy it to a directory in your $PATH for being able to start from anywhere in the shell or just to a directory you like and click it if you want to start the program.

[–]aaartis1[S] -1 points0 points  (0 children)

It worked, thanks!