Linux: bin file not found when executed using a symbolic link in another folder

In Linux, I have a symbolic link to a .bin file in:

~/bin>

So, I have:

~/bin>l

lrwxrwxrwx  1 myuser mymachine    56 Sep 27 09:25 Myfile.bin -> ./otherFolder/Myfile.bin

If I execute this .bin in the "bin" folder, there is no problem:

~/bin>Myfile.bin

But if I execute it from another folder:

~/other>../bin/Myfile.bin

the result is:

-bash: /home/myuser/bin/Myfile.bin: No such file or directory

Why is this happening?

Thanks.

Upvotes: 1

Views: 2952

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185254

I think your symlink is broken.

What is the output of

cd ~/bin
file ./otherFolder/Myfile.bin

?

edit

If you do :

~/bin>Myfile.bin

you run Myfile.bin from PATH, and it's not necessary ~/bin, depends of your $PATH variable.

Upvotes: 5

Related Questions