On LMDE-based laptop I have a script upgrade.sh
which only runs the following commands:
#!/bin/sh
apt-get upgrade
apt-get dist-upgrade
The script is in the /home/francois/scripts
directory. I can easily run it from within this directory. It just works. Now I run the following commands:
$ sudo ln -s /home/francois/scripts /opt/scripts
$ sudo ln -s /opt/scripts /usr/local/bin/scripts
and create file /etc/profile.d/myscripts.sh
with just one line:
export PATH=$PATH:/usr/local/bin/scripts
I type
$ echo $PATH
and see that it contains /usr/local/bin/scripts
But when I run
$ sudo upgrade.sh
from any directory the system says that the command not found
ls -l
shows -rwxr-xr-x 1 francois francois
...