directory for locally installed programs

Asked by Daniel Brumbaugh-Keeney

There is a program (ecmascript reference implementation) which I downloaded. It is a precompiled binary and it's associated files.
I have put the folder in /usr/local
The path to the shell script which runs the program is then /usr/local/es4/es4
I wrote this shell script

#!/bin/sh
/usr/local/es4/es4

and saved it as /usr/bin/es4

When I type es4 in the command line, I get the following message
bash: /usr/bin/es4: Permission denied

What did I do wrong?
Is the correct way to install such programs?
Did I put everything in the correct directories?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Cesare Tirabassi
Solved:
Last query:
Last reply:
Revision history for this message
Cesare Tirabassi (norsetto) said :
#1

If you check:

ls -l /usr/bin/es4

you will see the permissions of the file.
It should be -rwxr-xr-x (that is, 755), owner and group root.

You can correct it with chmod and chown commands:

sudo chmod 755 /usr/bin/es4
sudo chown root:root /usr/bin/es4

Revision history for this message
Best Cesare Tirabassi (norsetto) said :
#2

I forgot to mention, its good practice to use a local bin in your home directory for these kinds of scripts instead of /usr/bin.

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#3

unfortunately, ~/bin doesn't appear to be in the path (correct word?)
When I put it in ~/bin/es4, I get this message:
bash: /usr/bin/es4: No such file or directory

thanks for solving the main problem, though.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#4

Thats strange, it should be. Can you check with this command:

echo $PATH

if /home/xxxxx/bin is not there (xxxxx its your user's name), you can add it by adding this line in .bashrc or /etc/bash.bashrc:

export PATH=$PATH:$HOME/bin

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#5

Thanks Cesare Tirabassi, that solved my question.

Revision history for this message
Daniel Brumbaugh-Keeney (db-keen) said :
#6

I don't know what was wrong earlier, it works fine now. Thanks.