user3168219
user3168219

Reputation: 315

Symlink to bash file

I'm trying to symlink a roo.sh file to /usr/local/bin so I can use the roo command directly but I'm having some troubles.

$ ls
roo.sh
$ ln -s roo.sh /usr/local/bin/roo
$ chmod +x /usr/local/bin/roo
$ roo
command not found
$ bash /usr/local/bin/roo
No such file or directory

Upvotes: 2

Views: 4967

Answers (2)

mata
mata

Reputation: 69042

ln -s roo.sh /usr/local/bin/roo would create a symlink to a file roo.sh in the same directory (/usr/local/bin/roo --> /usr/local/bin/roo.sh) - you can verify this by using ls -l /usr/local/bin/roo.

To avoid this, use the full path to roo.sh when creating the symlink:

ln -s /path/to/roo.sh /usr/local/bin/roo

Upvotes: 6

BaBL86
BaBL86

Reputation: 2622

Do you have anough privileges to create /usr/local/bin/roo ?

Does your script start with:

#!/bin/bash

?

Try to use sudo, if it's installed or invoke this commands by root user.

Upvotes: -1

Related Questions