You can do this by either:
Add the directory of the command to the $PATH variable, thus:
export PATH=$PATH:/dir/bin
To do this persistent, you must add this line to the ~/.profile file:
echo 'export PATH=$PATH:/dir/bin' >> ~/.profile
Create a shortcut (for instance with ln -s '/dir/bin/start.sh' start) in a directory that is added to the path;
cd <pathdirectory>
ln -s '/dir/bin/start.sh' start
Create an alias so that the shell simply replaces the command:
echo 'alias start=./dir/bin/start.sh' >> ~/.profile
How/Why does this work
If you type a command in the shell, it will first look for aliases, and replace the aliases. So if you have defined an alias for start, it will simply replace is by ./dir/bin/start.sh; so as if you have written it yourself.
Next the shell will try to find the interpretation of the command. If the command is a file (for instance by using a alias), the file is executed. Otherwise, the system falls back on $PATHs.
$PATHs is a sequence of paths where the system searches for a file with that name. It searches the paths in that order and searches through all the files for a file with the same name. If such file exists, it runs that file.
You can thus do a few things:
- Place such program in the directory; but that's not really a nice option, because different projects are then grouped together;
- Use a shortcut (the
ln solution), in that case you only add a "representative" in the path folder;
- Extend the number of paths by performing the
PATH=$PATH:/dir/bin, so that it will search your project as well.
export PATH=${PATH}:/path/to/dir/of/start.sh,cd /path/to/dir/of/start.sh,ln -s start.sh start.alias start=/dir/bin/start.sh. Orstart() { /dir/bin/start.sh "$@" ; }:p